I am new to ember.js and learning it by examining the code base of a ember.js application.
It's a blogging application, in the route /routes/posts.js the code fetches two computed properties from controller,
var currentPost = this.get('controller.currentPost');
var posts = this.get('controller.sortedPosts');
I know ember.js infers a lot of things so I assume this controller refers to the controller /controllers/posts.js, I looked and found the definition of the property sortedPosts, but there is no definition of the property currentPost, I inserted a line of code console.log(currentPost) and I can see the correct value is being output in console tab in the browser dev tool but I can't figure out where this property is defined.
I was trying to find answer in ember.js official documentation but no luck. My question is
- does ember.js indeed infers the controller as
/controllers/posts.jsby the file name - is ember even smart enough to automatically load the model as
currentPost
Thanks.
Aucun commentaire:
Enregistrer un commentaire