Skip to content
This repository was archived by the owner on Feb 22, 2018. It is now read-only.

Commit 1cb8eb9

Browse files
committed
fix(binding): call attach when attribute is not specified
1 parent c9bf23a commit 1cb8eb9

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

lib/core_dom/compiler.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ class Compiler {
156156
break;
157157
case '<=>':
158158
mappingFn = (NodeAttrs attrs, Scope scope, Object controller, FilterMap filters, notify()) {
159-
if (attrs[attrName] == null) return;
159+
if (attrs[attrName] == null) return notify();
160160
String expression = attrs[attrName];
161161
Expression expressionFn = _parser(expression);
162162
var blockOutbound = false;
@@ -193,7 +193,7 @@ class Compiler {
193193
break;
194194
case '=>':
195195
mappingFn = (NodeAttrs attrs, Scope scope, Object controller, FilterMap filters, notify()) {
196-
if (attrs[attrName] == null) return;
196+
if (attrs[attrName] == null) return notify();
197197
Expression attrExprFn = _parser(attrs[attrName]);
198198
var shadowValue = null;
199199
scope.watch(attrs[attrName],
@@ -206,7 +206,7 @@ class Compiler {
206206
break;
207207
case '=>!':
208208
mappingFn = (NodeAttrs attrs, Scope scope, Object controller, FilterMap filters, notify()) {
209-
if (attrs[attrName] == null) return;
209+
if (attrs[attrName] == null) return notify();
210210
Expression attrExprFn = _parser(attrs[attrName]);
211211
var watch;
212212
watch = scope.watch(

test/core_dom/compiler_spec.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -786,7 +786,10 @@ class LogComponent {
786786
map: const {
787787
'attr-value': '@attrValue',
788788
'expr-value': '<=>exprValue',
789-
'once-value': '=>!onceValue'
789+
'once-value': '=>!onceValue',
790+
'optional-one': '=>optional',
791+
'optional-two': '<=>optional',
792+
'optional-once': '=>!optional',
790793
}
791794
)
792795
class AttachDetachComponent implements NgAttachAware, NgDetachAware, NgShadowRootAware {
@@ -795,6 +798,7 @@ class AttachDetachComponent implements NgAttachAware, NgDetachAware, NgShadowRoo
795798
String attrValue = 'too early';
796799
String exprValue = 'too early';
797800
String onceValue = 'too early';
801+
String optional;
798802

799803
AttachDetachComponent(Logger this.logger, TemplateLoader templateLoader, Scope this.scope) {
800804
logger('new');

0 commit comments

Comments
 (0)