So, fwiw I think the answers are:

   1. there is only one NgModelController instance, and it is actually at 
   $scope.mainForm.fooForm.myInput ($scope is the one in MainCtrl)
   2. '$scope' inside the above NgModelController is NOT the one from 
   MainCtrl - rather it is the transcluded scope (created via prototypal 
   inheritance from MainCtrl.$scope) 

#1 makes sense; not sure I fully understand why $scope in #2 is NOT 
MainCtrl.$scope. Could someone please explain?

thanks,
-nikita

On Sunday, April 20, 2014 9:47:44 AM UTC-7, Nikita Tovstoles wrote:
>
> Say we have  a transclude directive <foo> (with iso scope) wrapping an 
> input:
>
> <div ng-controller="MainCtrl">
>  <form name="mainForm">
>     <foo><input ng-model="myInput" name="myInput" type="text"></foo>
>  </form>
> </div>
>
> where <foo> has the following template:
>
> <div ng-form="fooForm">
> <div ng-transclude></div>
> <button ng-click="saveChanges()">ok</button>
> <button ng-click="cancelChanges()">cancel</button>
> </div>
>
> NgModelController takes a scope as constructor param. Does that mean that 
> there will/can be multiple instances of NgModelController associated with 
> transcluded <input>:
>
>    1. one at $scope.mainForm.myInput (using $scope from MainCtrl)
>       1. mainForm will also be accessible to transcluded scope (via 
>       prototypal inheritance)
>    2. another at scope.fooForm.myInput (using isolate scope from <foo>) 
>
>
> ...and if so, can those two ctrls at times have unequal $viewValue and 
> $modelValue values - since the latter is derived from NgModelController's 
> scope?
>
> -nikita
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to