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

Commit

Permalink
fix(binding): call attach when attribute is not specified
Browse files Browse the repository at this point in the history
  • Loading branch information
mhevery committed Feb 20, 2014
1 parent c9bf23a commit 1cb8eb9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 3 additions & 3 deletions lib/core_dom/compiler.dart
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ class Compiler {
break;
case '<=>':
mappingFn = (NodeAttrs attrs, Scope scope, Object controller, FilterMap filters, notify()) {
if (attrs[attrName] == null) return;
if (attrs[attrName] == null) return notify();
String expression = attrs[attrName];
Expression expressionFn = _parser(expression);
var blockOutbound = false;
Expand Down Expand Up @@ -193,7 +193,7 @@ class Compiler {
break;
case '=>':
mappingFn = (NodeAttrs attrs, Scope scope, Object controller, FilterMap filters, notify()) {
if (attrs[attrName] == null) return;
if (attrs[attrName] == null) return notify();
Expression attrExprFn = _parser(attrs[attrName]);
var shadowValue = null;
scope.watch(attrs[attrName],
Expand All @@ -206,7 +206,7 @@ class Compiler {
break;
case '=>!':
mappingFn = (NodeAttrs attrs, Scope scope, Object controller, FilterMap filters, notify()) {
if (attrs[attrName] == null) return;
if (attrs[attrName] == null) return notify();
Expression attrExprFn = _parser(attrs[attrName]);
var watch;
watch = scope.watch(
Expand Down
6 changes: 5 additions & 1 deletion test/core_dom/compiler_spec.dart
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,10 @@ class LogComponent {
map: const {
'attr-value': '@attrValue',
'expr-value': '<=>exprValue',
'once-value': '=>!onceValue'
'once-value': '=>!onceValue',
'optional-one': '=>optional',
'optional-two': '<=>optional',
'optional-once': '=>!optional',
}
)
class AttachDetachComponent implements NgAttachAware, NgDetachAware, NgShadowRootAware {
Expand All @@ -795,6 +798,7 @@ class AttachDetachComponent implements NgAttachAware, NgDetachAware, NgShadowRoo
String attrValue = 'too early';
String exprValue = 'too early';
String onceValue = 'too early';
String optional;

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

0 comments on commit 1cb8eb9

Please sign in to comment.