Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

7
  • Thx @Alex Beugnet for your comment ! Do you have an exemple to the constructor please ? I removed my constructor in my class to replace with your constructor, but in my component, the instance doesn't work because I don't have the parameter Commented Aug 30, 2017 at 9:53
  • Since you did everything around your model, you should just change it so that you can create a new instance of your movie class (in that case you will use new). See this post which shows a good example : stackoverflow.com/questions/38398877/…. Be aware that even though your MovieListComponent is still considered a smart component in that case since basically it does (through the link to your Movie Model) the call to the service. Commented Aug 30, 2017 at 9:56
  • Thx for your help, I updated my post (component) : I applied your recommandation from your link ! But I always confused to use my service in my class.. Commented Aug 30, 2017 at 10:09
  • Since you want to make your service call in the model, you need to pass the MovieService as a parameter when you do new Movie(), and your Movie model class needs to get the reference from the constructor Commented Aug 30, 2017 at 10:15
  • Thx @Alex Beugnet ! I updated my post (modification part, bottom post). Can you confirm this syntax please ? Because I can't set my result in an array Commented Aug 30, 2017 at 10:48