-
-
Save avukonke/8596869 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var app = angular.module("MyApp", []); | |
| app.controller("MyCtrl", function($scope) { | |
| $scope.name = "Peter"; | |
| $scope.user = { | |
| name: "Parker" | |
| }; | |
| }); | |
| app.controller("MyNestedCtrl", function($scope) { | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <html> | |
| <head> | |
| <script src="js/angular.js"></script> | |
| <script src="js/app.js"></script> | |
| <link rel="stylesheet" href="css/bootstrap.css"> | |
| <style> | |
| .nested { | |
| border: 1px solid red; | |
| margin-left: 2em; | |
| padding: 1em; | |
| } | |
| </style> | |
| </head> | |
| <body ng-app="MyApp"> | |
| <div ng-controller="MyCtrl"> | |
| <label>Primitive</label> | |
| <input type="text" ng-model="name"> | |
| <label>Object</label> | |
| <input type="text" ng-model="user.name"> | |
| <div class="nested" ng-controller="MyNestedCtrl"> | |
| <label>Primitive</label> | |
| <input type="text" ng-model="name"> | |
| <label>Primitive with explicit $parent reference</label> | |
| <input type="text" ng-model="$parent.name"> | |
| <label>Object</label> | |
| <input type="text" ng-model="user.name"> | |
| </div> | |
| </div> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment