with model variables defined directly on the scopes</h2> (typing on an input field, with a data binding to the model, overrides the same variable of a parent scope) </p> <div ng-controller="firstControllerScope"> <h3>First controller</h3> <strong>First name:</strong> {{firstName}}<br /> <br /> <label>Set the first name: <input type="text" ng-model="firstName"/></label><br /> <br /> <div ng-controller="secondControllerScope"> <h3>Second controller (inside First)</h3> <strong>First name (from First):</strong> {{firstName}}<br /> <strong>Last name (new variable):</strong> {{lastName}}<br /> <strong>Full name:</strong> {{getFullName()}}<br /> <br /> <label>Set the first name: <input type="text" ng-model="firstName"/></label><br /> <label>Set the last name: <input type="text" ng-model="lastName"/></label><br /> <br /> <div ng-controller="thirdControllerScope"> <h3>Third controller (inside Second and First)</h3> <strong>First name (from First):</strong> {{firstName}}<br /> <strong>Middle name (new variable):</strong> {{middleName}}<br /> <strong>Last name (from Second):</strong> {{$parent.lastName}}<br /> <strong>Last name (redefined in Third):</strong> {{lastName}}<br /> <strong>Full name (redefined in Third):</strong> {{getFullName()}}<br /> <br /> <label>Set the first name: <input type="text" ng-model="firstName"/></label><br /> <label>Set the middle name: <input type="text" ng-model="middleName"/></label><br /> <label>Set the last name: <input type="text" ng-model="lastName"/></label> </div> </div> </div> <br /> <p> <h2>Nested controllers with model variables defined inside objects</h2> (typing on an input field, with a data binding to the model, acts on a specific object without overriding variables) </p> <div ng-controller="firstControllerObj"> <h3>First controller</h3> <strong>First name:</strong> {{firstModelObj.firstName}}<br /> <br /> <label>Set the first name: <input type="text" ng-model="firstModelObj.firstName"/></label><br /> <br /> <div ng-controller="secondControllerObj"> <h3>Second controller (inside First)</h3> <strong>First name (from First):</strong> {{firstModelObj.firstName}}<br /> <strong>Last name (from Second):</strong> {{secondModelObj.lastName}}<br /> <strong>Full name:</strong> {{getFullName()}}<br /> <br /> <label>Set the first name: <input type="text" ng-model="firstModelObj.firstName"/></label><br /> <label>Set the last name: <input type="text" ng-model="secondModelObj.lastName"/></label><br /> <br /> <div ng-controller="thirdControllerObj"> <h3>Third controller (inside Second and First)</h3> <strong>First name (from First):</strong> {{firstModelObj.firstName}}<br /> <strong>Middle name (from Third):</strong> {{thirdModelObj.middleName}}<br /> <strong>Last name (from Second):</strong> {{secondModelObj.lastName}}<br /> <strong>Last name (from Third):</strong> {{thirdModelObj.lastName}}<br /> <strong>Full name (redefined in Third):</strong> {{getFullName()}}<br /> <br /> <label>Set the first name: <input type="text" ng-model="firstModelObj.firstName"/></label><br /> <label>Set the middle name: <input type="text" ng-model="thirdModelObj.middleName"/></label><br /> <label>Set the last name: <input type="text" ng-model="thirdModelObj.lastName"/></label> </div> AngularJS Hub by Andrea Bresolin is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
with model variables defined directly on the scopes</h2> (typing on an input field, with a data binding to the model, overrides the same variable of a parent scope) </p> <div ng-controller="firstControllerScope"> <h3>First controller</h3> <strong>First name:</strong> {{firstName}}<br /> <br /> <label>Set the first name: <input type="text" ng-model="firstName"/></label><br /> <br /> <div ng-controller="secondControllerScope"> <h3>Second controller (inside First)</h3> <strong>First name (from First):</strong> {{firstName}}<br /> <strong>Last name (new variable):</strong> {{lastName}}<br /> <strong>Full name:</strong> {{getFullName()}}<br /> <br /> <label>Set the first name: <input type="text" ng-model="firstName"/></label><br /> <label>Set the last name: <input type="text" ng-model="lastName"/></label><br /> <br /> <div ng-controller="thirdControllerScope"> <h3>Third controller (inside Second and First)</h3> <strong>First name (from First):</strong> {{firstName}}<br /> <strong>Middle name (new variable):</strong> {{middleName}}<br /> <strong>Last name (from Second):</strong> {{$parent.lastName}}<br /> <strong>Last name (redefined in Third):</strong> {{lastName}}<br /> <strong>Full name (redefined in Third):</strong> {{getFullName()}}<br /> <br /> <label>Set the first name: <input type="text" ng-model="firstName"/></label><br /> <label>Set the middle name: <input type="text" ng-model="middleName"/></label><br /> <label>Set the last name: <input type="text" ng-model="lastName"/></label> </div> </div> </div> <br /> <p> <h2>Nested controllers with model variables defined inside objects</h2> (typing on an input field, with a data binding to the model, acts on a specific object without overriding variables) </p> <div ng-controller="firstControllerObj"> <h3>First controller</h3> <strong>First name:</strong> {{firstModelObj.firstName}}<br /> <br /> <label>Set the first name: <input type="text" ng-model="firstModelObj.firstName"/></label><br /> <br /> <div ng-controller="secondControllerObj"> <h3>Second controller (inside First)</h3> <strong>First name (from First):</strong> {{firstModelObj.firstName}}<br /> <strong>Last name (from Second):</strong> {{secondModelObj.lastName}}<br /> <strong>Full name:</strong> {{getFullName()}}<br /> <br /> <label>Set the first name: <input type="text" ng-model="firstModelObj.firstName"/></label><br /> <label>Set the last name: <input type="text" ng-model="secondModelObj.lastName"/></label><br /> <br /> <div ng-controller="thirdControllerObj"> <h3>Third controller (inside Second and First)</h3> <strong>First name (from First):</strong> {{firstModelObj.firstName}}<br /> <strong>Middle name (from Third):</strong> {{thirdModelObj.middleName}}<br /> <strong>Last name (from Second):</strong> {{secondModelObj.lastName}}<br /> <strong>Last name (from Third):</strong> {{thirdModelObj.lastName}}<br /> <strong>Full name (redefined in Third):</strong> {{getFullName()}}<br /> <br /> <label>Set the first name: <input type="text" ng-model="firstModelObj.firstName"/></label><br /> <label>Set the middle name: <input type="text" ng-model="thirdModelObj.middleName"/></label><br /> <label>Set the last name: <input type="text" ng-model="thirdModelObj.lastName"/></label> </div> AngularJS Hub by Andrea Bresolin is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License. だいたい こうなるよね
with model variables defined directly on the scopes</h2> (typing on an input field, with a data binding to the model, overrides the same variable of a parent scope) </p> <div ng-controller="firstControllerScope"> <h3>First controller</h3> <strong>First name:</strong> {{firstName}}<br /> <br /> <label>Set the first name: <input type="text" ng-model="firstName"/></label><br /> <br /> <div ng-controller="secondControllerScope"> <h3>Second controller (inside First)</h3> <strong>First name (from First):</strong> {{firstName}}<br /> <strong>Last name (new variable):</strong> {{lastName}}<br /> <strong>Full name:</strong> {{getFullName()}}<br /> <br /> <label>Set the first name: <input type="text" ng-model="firstName"/></label><br /> <label>Set the last name: <input type="text" ng-model="lastName"/></label><br /> <br /> <div ng-controller="thirdControllerScope"> <h3>Third controller (inside Second and First)</h3> <strong>First name (from First):</strong> {{firstName}}<br /> <strong>Middle name (new variable):</strong> {{middleName}}<br /> <strong>Last name (from Second):</strong> {{$parent.lastName}}<br /> <strong>Last name (redefined in Third):</strong> {{lastName}}<br /> <strong>Full name (redefined in Third):</strong> {{getFullName()}}<br /> <br /> <label>Set the first name: <input type="text" ng-model="firstName"/></label><br /> <label>Set the middle name: <input type="text" ng-model="middleName"/></label><br /> <label>Set the last name: <input type="text" ng-model="lastName"/></label> </div> </div> </div> <br /> <p> <h2>Nested controllers with model variables defined inside objects</h2> (typing on an input field, with a data binding to the model, acts on a specific object without overriding variables) </p> <div ng-controller="firstControllerObj"> <h3>First controller</h3> <strong>First name:</strong> {{firstModelObj.firstName}}<br /> <br /> <label>Set the first name: <input type="text" ng-model="firstModelObj.firstName"/></label><br /> <br /> <div ng-controller="secondControllerObj"> <h3>Second controller (inside First)</h3> <strong>First name (from First):</strong> {{firstModelObj.firstName}}<br /> <strong>Last name (from Second):</strong> {{secondModelObj.lastName}}<br /> <strong>Full name:</strong> {{getFullName()}}<br /> <br /> <label>Set the first name: <input type="text" ng-model="firstModelObj.firstName"/></label><br /> <label>Set the last name: <input type="text" ng-model="secondModelObj.lastName"/></label><br /> <br /> <div ng-controller="thirdControllerObj"> <h3>Third controller (inside Second and First)</h3> <strong>First name (from First):</strong> {{firstModelObj.firstName}}<br /> <strong>Middle name (from Third):</strong> {{thirdModelObj.middleName}}<br /> <strong>Last name (from Second):</strong> {{secondModelObj.lastName}}<br /> <strong>Last name (from Third):</strong> {{thirdModelObj.lastName}}<br /> <strong>Full name (redefined in Third):</strong> {{getFullName()}}<br /> <br /> <label>Set the first name: <input type="text" ng-model="firstModelObj.firstName"/></label><br /> <label>Set the middle name: <input type="text" ng-model="thirdModelObj.middleName"/></label><br /> <label>Set the last name: <input type="text" ng-model="thirdModelObj.lastName"/></label> </div> AngularJS Hub by Andrea Bresolin is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License. このまま 大規模アプリ作りますか