angularjs - Does ngForm create a new scope -


does ng-form directive creates new sub scope in angular js ?

had been googling half hour couldnt find much.

nope. can tell plunker ng-form not create new scope.

<h2>parent scope</h2> <input ng-model="name" /> <p>hello {{name}}!</p> <h2>ng-form</h2> <ng-form>   <input ng-model="name" />   <p>hello {{name}}!</p> </ng-form> <h2>ng-if</h2> <div ng-if="true">   <input ng-model="name" />   <p>hello {{name}}!</p> </div> 

the way can tell same reason should never put primitive on scope. if change first 2 inputs, name variable changes three. if change last input, change there. , after point stop responding changes made on first 2 input boxes (since using parent scope's name variable, once interact within scope, has own variable).


Comments