Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 1e7675a

Browse files
revolunetpetebacondarwin
authored andcommitted
docs(input): remove deprecated isolated scope pitfall
The 1.2 release fixed the documented pitfall at 909cabd by isolating only the isolated directive's scope. Closes #5179
1 parent 280b5ce commit 1e7675a

File tree

1 file changed

+0
-33
lines changed

1 file changed

+0
-33
lines changed

src/ng/directive/input.js

-33
Original file line numberDiff line numberDiff line change
@@ -951,39 +951,6 @@ var VALID_CLASS = 'ng-valid',
951951
</file>
952952
* </example>
953953
*
954-
* ## Isolated Scope Pitfall
955-
*
956-
* Note that if you have a directive with an isolated scope, you cannot require `ngModel`
957-
* since the model value will be looked up on the isolated scope rather than the outer scope.
958-
* When the directive updates the model value, calling `ngModel.$setViewValue()` the property
959-
* on the outer scope will not be updated. However you can get around this by using $parent.
960-
*
961-
* Here is an example of this situation. You'll notice that the first div is not updating the input.
962-
* However the second div can update the input properly.
963-
*
964-
* <example module="badIsolatedDirective">
965-
<file name="script.js">
966-
angular.module('badIsolatedDirective', []).directive('isolate', function() {
967-
return {
968-
require: 'ngModel',
969-
scope: { },
970-
template: '<input ng-model="innerModel">',
971-
link: function(scope, element, attrs, ngModel) {
972-
scope.$watch('innerModel', function(value) {
973-
console.log(value);
974-
ngModel.$setViewValue(value);
975-
});
976-
}
977-
};
978-
});
979-
</file>
980-
<file name="index.html">
981-
<input ng-model="someModel"/>
982-
<div isolate ng-model="someModel"></div>
983-
<div isolate ng-model="$parent.someModel"></div>
984-
</file>
985-
* </example>
986-
*
987954
*
988955
*/
989956
var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$parse',

0 commit comments

Comments
 (0)