aboutsummaryrefslogtreecommitdiffstats
path: root/src/ng/compile.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/ng/compile.js')
-rw-r--r--src/ng/compile.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/ng/compile.js b/src/ng/compile.js
index 5508605e..f39b0935 100644
--- a/src/ng/compile.js
+++ b/src/ng/compile.js
@@ -768,13 +768,14 @@ function $CompileProvider($provide) {
$element = attrs.$$element;
if (newIsolateScopeDirective) {
- var LOCAL_REGEXP = /^\s*([@=&])\s*(\w*)\s*$/;
+ var LOCAL_REGEXP = /^\s*([@=&])(\??)\s*(\w*)\s*$/;
var parentScope = scope.$parent || scope;
forEach(newIsolateScopeDirective.scope, function(definiton, scopeName) {
var match = definiton.match(LOCAL_REGEXP) || [],
- attrName = match[2]|| scopeName,
+ attrName = match[3] || scopeName,
+ optional = (match[2] == '?'),
mode = match[1], // @, =, or &
lastValue,
parentGet, parentSet;
@@ -796,6 +797,9 @@ function $CompileProvider($provide) {
}
case '=': {
+ if (optional && !attrs[attrName]) {
+ return;
+ }
parentGet = $parse(attrs[attrName]);
parentSet = parentGet.assign || function() {
// reset the change, or we will throw this exception on every $digest