Last active
August 29, 2015 14:04
-
-
Save aeisenberg/07cbf18afcb68bddbc96 to your computer and use it in GitHub Desktop.
Nested scopes in angular behave strangely because of prototypal inheritance.
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.1/angular.js" | |
type="text/javascript" charset="utf-8"></script> | |
<script type="text/javascript"> | |
angular.module('watchingApp', []) | |
.controller('watchedController', function($scope) { | |
$scope.value = 9; | |
}) | |
.controller('watchingController', function($scope) { }); | |
</script> | |
</head> | |
<body ng-app="watchingApp"> | |
<div ng-controller="watchedController"> | |
Value is {{value}}. | |
<br /> | |
<div ng-controller="watchingController"> | |
Value is {{value}}. | |
<br /> | |
<textarea ng-model="value">{{value}}</textarea> | |
</div> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment