From 46d396df72aab0678eddc3d4aac02c4ba95ceef4 Mon Sep 17 00:00:00 2001 From: basarat Date: Wed, 16 Oct 2013 12:13:54 +1100 Subject: [PATCH] docs(ngModelController): $parent can help isolate scope directives --- src/ng/directive/input.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/ng/directive/input.js b/src/ng/directive/input.js index 6e4961f85668..804a86c041d6 100644 --- a/src/ng/directive/input.js +++ b/src/ng/directive/input.js @@ -939,14 +939,14 @@ var VALID_CLASS = 'ng-valid', * Note that if you have a directive with an isolated scope, you cannot require `ngModel` * since the model value will be looked up on the isolated scope rather than the outer scope. * When the directive updates the model value, calling `ngModel.$setViewValue()` the property - * on the outer scope will not be updated. + * on the outer scope will not be updated. However you can get around this by using $parent. * - * Here is an example of this situation. You'll notice that even though both 'input' and 'div' - * seem to be attached to the same model, they are not kept in synch. + * Here is an example of this situation. You'll notice that the first div is not updating the input. + * However the second div can update the input properly. * * - angular.module('badIsolatedDirective', []).directive('bad', function() { + angular.module('badIsolatedDirective', []).directive('isolate', function() { return { require: 'ngModel', scope: { }, @@ -961,8 +961,9 @@ var VALID_CLASS = 'ng-valid', }); - -
+ +
+
*
*