Posts

Showing posts with the label ember-data

Ember - No Data in hasMany Relationship On Initial Load

Image
Clash Royale CLAN TAG #URR8PPP Ember - No Data in hasMany Relationship On Initial Load ember-cli - 3.20, ember-data - 3.30 I am trying to modify the data in a hasMany relationship in the controller setup but the relationship has no data. However, all the data is there after the page is fully loaded (i.e. in my template/actions, all relationship data is there) I have a Quiz application with Many-Many relationship with Questions. models/Quiz.js import { computed } from '@ember/object'; import DS from 'ember-data'; const { attr, hasMany, Model } = DS; export default Model.extend({ description: attr('string'), questions: hasMany('question', {async: true}) //also tried with async false }); models/Question.js export default Model.extend({ question: attr('string'), quizzes: hasMany('quiz', {async: true}) //also tried with async false }); Go to url '/quiz/1' and Route calls findRecord on quiz routes/quizzes/quiz.js import Route f...