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

Commit ca16eac

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 #6060
1 parent bf6a79c commit ca16eac

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/ng/compile.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -1906,8 +1906,12 @@ function $CompileProvider($provide, $$sanitizeUriProvider) {
19061906
break;
19071907

19081908
case '=':
1909-
if (optional && !attrs[attrName]) {
1910-
return;
1909+
if (!attrs[attrName]) {
1910+
if (optional) {
1911+
return;
1912+
}
1913+
throw Error('Non-assignable model expression: ' + attrs[attrName]
1914+
+ ' (directive: ' + newIsolateScopeDirective.name + ')');
19111915
}
19121916
parentGet = $parse(attrs[attrName]);
19131917
if (parentGet.literal) {

0 commit comments

Comments
 (0)