Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit fdbd92f

Browse files
wesleychoNarretz
authored andcommittedJan 24, 2016
docs($compile): improve nonassign error message
- Improve error message to mention attribute the expression errored on Fixes #13827 Closes #13828
1 parent 3b27dd3 commit fdbd92f

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed
 

‎src/ng/compile.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2660,8 +2660,8 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
26602660
// reset the change, or we will throw this exception on every $digest
26612661
lastValue = destination[scopeName] = parentGet(scope);
26622662
throw $compileMinErr('nonassign',
2663-
"Expression '{0}' used with directive '{1}' is non-assignable!",
2664-
attrs[attrName], directive.name);
2663+
"Expression '{0}' in attribute '{1}' used with directive '{2}' is non-assignable!",
2664+
attrs[attrName], attrName, directive.name);
26652665
};
26662666
lastValue = destination[scopeName] = parentGet(scope);
26672667
var parentValueWatch = function parentValueWatch(parentValue) {

‎test/ng/compileSpec.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3977,7 +3977,7 @@ describe('$compile', function() {
39773977

39783978
componentScope.ref = 'ignore me';
39793979
expect(function() { $rootScope.$apply(); }).
3980-
toThrowMinErr("$compile", "nonassign", "Expression ''hello ' + name' used with directive 'myComponent' is non-assignable!");
3980+
toThrowMinErr("$compile", "nonassign", "Expression ''hello ' + name' in attribute 'ref' used with directive 'myComponent' is non-assignable!");
39813981
expect(componentScope.ref).toBe('hello world');
39823982
// reset since the exception was rethrown which prevented phase clearing
39833983
$rootScope.$$phase = null;
@@ -3994,7 +3994,7 @@ describe('$compile', function() {
39943994

39953995
componentScope.ref = 'ignore me';
39963996
expect(function() { $rootScope.$apply(); }).
3997-
toThrowMinErr("$compile", "nonassign", "Expression 'undefined' used with directive 'myComponent' is non-assignable!");
3997+
toThrowMinErr("$compile", "nonassign", "Expression 'undefined' in attribute 'ref' used with directive 'myComponent' is non-assignable!");
39983998
expect(componentScope.ref).toBeUndefined();
39993999

40004000
$rootScope.$$phase = null; // reset since the exception was rethrown which prevented phase clearing
@@ -4051,7 +4051,7 @@ describe('$compile', function() {
40514051
componentScope.reference = {name: 'b'};
40524052
expect(function() {
40534053
$rootScope.$apply();
4054-
}).toThrowMinErr("$compile", "nonassign", "Expression '{name: name}' used with directive 'myComponent' is non-assignable!");
4054+
}).toThrowMinErr("$compile", "nonassign", "Expression '{name: name}' in attribute 'reference' used with directive 'myComponent' is non-assignable!");
40554055

40564056
}));
40574057

0 commit comments

Comments
 (0)
This repository has been archived.