I take two example in angular js but I am getting unexpected result .Example of nested controller :
First example
<div ng-controller="maincontroller">
<input ng-model="data.name">
<h1>{{data.name}}</h1>
<div ng-controller="nestedcontroller">
<input ng-model="data.name">
<h1>{{data.name}}</h1>
<div ng-controller="nestedANOTHERcontroller">
<input ng-model="data.name">
<h1>{{data.name}}</h1>
</div>
</div>
<div ng-controller="nestedOUTERRcontroller">
<input ng-model="data.name">
<h1>{{data.name}}</h1>
</div>
</div>
when I take "data.name" in all nested controller .Now when I change any input field it reflect in all input field and header field.why ?
Secondly when I take "name" instead of "data.name"
<div ng-controller="maincontroller">
<input ng-model="name">
<h1>{{name}}</h1>
<div ng-controller="nestedcontroller">
<input ng-model="name">
<h1>{{name}}</h1>
<div ng-controller="nestedANOTHERcontroller">
<input ng-model="name">
<h1>{{name}}</h1>
</div>
</div>
<div ng-controller="nestedOUTERRcontroller">
<input ng-model="name">
<h1>{{name}}</h1>
</div>
</div>
when I change on top input field it change in all input field and header field.but when i move to second input field it change to it's nested(children) input field and header but not change to upper controller and sibling controller why ? and when I move to inner most controller and change the text inside the input field it show header .Now if it parent controller try to change its text it it is not able to do .parents controller now change its only its text why ?
here is my code http://codepen.io/anon/pen/xGGJKR
Thanks