Chapter 5: Managing $scope inheritance
HTML
<script src="https://code.angularjs.org/1.3.2/angular.min.js"></script>
<div ng-app="myApp">
<div ng-controller="outerCtrl">
<input ng-model="data" />
<div ng-controller="innerCtrl">
<input ng-model="data" />
</div>
<div ng-controller="innerCtrl">
<input ng-model="data" />
<button ng-click="reattach()">Reattach</button>
</div>
</div>
</div>
JavaScript
angular.module('myApp', [])
.controller('outerCtrl', function($scope) {
$scope.data = 123;
})
.controller('innerCtrl', function($scope) {
$scope.reattach = function() {
delete($scope.data);
};
});