aboutsummaryrefslogtreecommitdiffstats
path: root/src/ng/directive/input.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/ng/directive/input.js')
-rw-r--r--src/ng/directive/input.js13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/ng/directive/input.js b/src/ng/directive/input.js
index 6e4961f8..804a86c0 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.
*
* <example module="badIsolatedDirective">
<file name="script.js">
- 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',
});
</file>
<file name="index.html">
- <input ng-model="someModel">
- <div bad ng-model="someModel"></div>
+ <input ng-model="someModel"/>
+ <div isolate ng-model="someModel"></div>
+ <div isolate ng-model="$parent.someModel"></div>
</file>
* </example>
*