diff --git a/lib/block.dart b/lib/block.dart index 6704f28c8..7f9c77a8d 100644 --- a/lib/block.dart +++ b/lib/block.dart @@ -322,7 +322,8 @@ class ComponentFactory { shadowScope[attrName] = attrValue; } else if (mapping == '=') { ParsedFn expr = parser(attrValue); - var shadowValue; + var shadowValue = expr(parentScope); + shadowScope[attrName] = shadowValue; shadowScope.$watch( () => expr(parentScope), (v) => shadowScope[attrName] = shadowValue = v); diff --git a/test/compiler_spec.dart b/test/compiler_spec.dart index 4aff600c1..c63117967 100644 --- a/test/compiler_spec.dart +++ b/test/compiler_spec.dart @@ -456,6 +456,18 @@ main() { expect($rootScope.done).toEqual(true); })); + it('should create a component with IO and "=" binding value should be available', inject(() { + $rootScope.name = 'misko'; + var element = $(r'
'); + $compile(element)(injector, element); + var component = $rootScope.ioComponent; + expect(component.scope.expr).toEqual('misko'); + $rootScope.$apply(); + component.scope.expr = 'angular'; + $rootScope.$apply(); + expect($rootScope.name).toEqual('angular'); + })); + it('should expose mapped attributes as camel case', inject(() { var element = $(''); $compile(element)(injector, element);