AngularJS Controller Aggregate

$ scope view data model representative of an intermediate bridge: an object in the domain model and scope view can be shared, and the data is bidirectional synchronous controller scope: package data processing element controller is responsible for the label, if the sub elements nested Controller, then the corresponding sub-element acting Controller subject distance to the nearest sub-elements (such a principle role in recent Jmeter testing framework, avalon also reflects the ms-controller)

HTML text:


myCtrl01 the


name: {{firstName + "" + lastName}}

myCtrl02 scope


name: {{firstName + "" + lastName}}

Javascript operation code:

  // defines the application controller, responsible for the specific data processing: // definition of angular application name: myApp: a html only one application, if there is a plurality of first subject to var app = angular. module ( 'myApp', []); app.controller ( 'myCtrl01', function ($ scope) {/ * background object stored the scope domain: the page stored in the label: * ng-init initializes variables * ng-model: initialize variables and the number of binding * / $ scope.firstNamE = "john"; $ scope.lastname = "doe";}); app.controller ('myctrl02', function ($ scope) {$ scope.firstname = "hello"; $ scope.lastname = "python"; });  

The above is all the content of this article, I hope to learn from everyone Help, I hope everyone will support Tumi Clouds.

AngularJS Controller作用域

© Copyright Notice
Just support it if you like
comment Grab the couch

Please log in to comment