Skip to content

Commit e50894b

Browse files
fix($compile): throw an exception when an attribute is unassigned
Documentation states that NON_ASSIGNABLE_MODEL_EXPRESSION exception should be thrown if a two-way attribute doesn't exist. This commit adds a simple test and throws an error if the property is missing. Note that the documentation should probably be updated and a different exception should be thrown using minErr. This commit refers to issue angular#6060
1 parent 7f4edaf commit e50894b

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/ng/compile.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -1426,8 +1426,13 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
14261426
break;
14271427

14281428
case '=':
1429-
if (optional && !attrs[attrName]) {
1430-
return;
1429+
if (!attrs[attrName]) {
1430+
if (optional) {
1431+
return;
1432+
} else {
1433+
throw Error('Non-assignable model expression: ' + attrs[attrName]
1434+
+ ' (directive: ' + newIsolateScopeDirective.name + ')');
1435+
}
14311436
}
14321437
parentGet = $parse(attrs[attrName]);
14331438
if (parentGet.literal) {

0 commit comments

Comments
 (0)