First, Controller: Define the variable, directly in the template display var helloember = Ember.Application.create (); Helloember.applicationcontroller = Ember.Controller.extend ({greeting: "Good Morning starshine!", Happythought: "The E Arth Says hello! "});<Body> <Div> <ScriptType= "Text/x-handlebars"Data-template-name= "Application"> <H1>{{Greeting}}</h1> <H3>{{Happythought}}</h3> </Script> </Div></Body>
<! the variables added to the-ember.controller are only valid in the main template- > second, rout in This.resource control which template displays App.Router.map (function () { this.resource (' Hu ', {path: '/'}); Root path loading hu}); third, the controller controls which template, which is determined by its name App.hu1controller =ember.controller.extend ({ name: ' Zlg '}), "Template in Hu1" Iv. Control Action
Variable assignment in templates the second way,the model of the route , the return value can be an object, an array, a value
Controller and route both render the template, the controller takes effect andthe model of the route fails
Arraycontroller Use Example
http://emberjs.com/api/classes/Ember.ArrayController.html data URL of the API
Ember--ember.js Ling's courseware