ember.js - Who defines the "store" object? -


from code snippet :

todos.todoscontroller = ember.arraycontroller.extend({   actions: {     createtodo: function() {       // todo title set "new todo" text field       var title = this.get('newtitle');       if (!title.trim()) { return; }        // create new todo model       var todo = this.store.createrecord('todo', {         title: title,         iscompleted: false       });        // clear "new todo" text field       this.set('newtitle', '');        // save new model       todo.save();       }     } }); 

which is, in fact, ember website

who defines (and defined) this.store ? looked in controller class , in dsl

the store ember data bookkeeping object.

it has been injected via ember's dependency injection api application's controllers , routes using initializer, can referenced route or controller this.store

the store same instance of 'store:main' regardless of called from, because has been injected.


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -