mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-05-09 07:14:44 +00:00
refactor($compile): simplify nodeLinkFn
This commit is contained in:
parent
4dbd8452eb
commit
4e45a2f8e2
1 changed files with 4 additions and 4 deletions
|
|
@ -706,12 +706,12 @@ function $CompileProvider($provide) {
|
||||||
}
|
}
|
||||||
$element = attrs.$$element;
|
$element = attrs.$$element;
|
||||||
|
|
||||||
if (newScopeDirective && isObject(newScopeDirective.scope)) {
|
if (newIsolatedScopeDirective) {
|
||||||
var LOCAL_REGEXP = /^\s*([@=&])\s*(\w*)\s*$/;
|
var LOCAL_REGEXP = /^\s*([@=&])\s*(\w*)\s*$/;
|
||||||
|
|
||||||
var parentScope = scope.$parent || scope;
|
var parentScope = scope.$parent || scope;
|
||||||
|
|
||||||
forEach(newScopeDirective.scope, function(definiton, scopeName) {
|
forEach(newIsolatedScopeDirective.scope, function(definiton, scopeName) {
|
||||||
var match = definiton.match(LOCAL_REGEXP) || [],
|
var match = definiton.match(LOCAL_REGEXP) || [],
|
||||||
attrName = match[2]|| scopeName,
|
attrName = match[2]|| scopeName,
|
||||||
mode = match[1], // @, =, or &
|
mode = match[1], // @, =, or &
|
||||||
|
|
@ -734,7 +734,7 @@ function $CompileProvider($provide) {
|
||||||
// reset the change, or we will throw this exception on every $digest
|
// reset the change, or we will throw this exception on every $digest
|
||||||
lastValue = scope[scopeName] = parentGet(parentScope);
|
lastValue = scope[scopeName] = parentGet(parentScope);
|
||||||
throw Error(NON_ASSIGNABLE_MODEL_EXPRESSION + attrs[attrName] +
|
throw Error(NON_ASSIGNABLE_MODEL_EXPRESSION + attrs[attrName] +
|
||||||
' (directive: ' + newScopeDirective.name + ')');
|
' (directive: ' + newIsolatedScopeDirective.name + ')');
|
||||||
};
|
};
|
||||||
lastValue = scope[scopeName] = parentGet(parentScope);
|
lastValue = scope[scopeName] = parentGet(parentScope);
|
||||||
scope.$watch(function parentValueWatch() {
|
scope.$watch(function parentValueWatch() {
|
||||||
|
|
@ -765,7 +765,7 @@ function $CompileProvider($provide) {
|
||||||
|
|
||||||
default: {
|
default: {
|
||||||
throw Error('Invalid isolate scope definition for directive ' +
|
throw Error('Invalid isolate scope definition for directive ' +
|
||||||
newScopeDirective.name + ': ' + definiton);
|
newIsolatedScopeDirective.name + ': ' + definiton);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue