javascript - Ember Needs API; ReferenceError: controllers is not defined -


i'm working on ember project. display list of books , descriptions passed down server. user can click on particular book, links comment page. but, want display book description on comments page. learned use needs api grab information book controller.

however, tried displaying {{controllers.book.description}} amidst html , wouldn't display anything. added below action print out console , received error: uncaught referenceerror: controllers not defined. using needs wrong? help.

app.bookcommentcontroller = ember.objectcontroller.extend({     needs: ["book"],     actions: {         getdescription: function() {             console.log(controllers.book.description);         }     } }); 

got it! turns out using wrong, difficult diagnose there's no documentation anywhere. in order print out console, ended using:

this.get('controllers') //i.e. console.log(this.get('controllers')) 

in order access controllers variable.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -