diff --git a/modules/angular2/src/render/dom/compiler/compiler.ts b/modules/angular2/src/render/dom/compiler/compiler.ts index d26fd4a281..1648197029 100644 --- a/modules/angular2/src/render/dom/compiler/compiler.ts +++ b/modules/angular2/src/render/dom/compiler/compiler.ts @@ -16,16 +16,14 @@ import {TemplateLoader} from 'angular2/src/render/dom/compiler/template_loader'; import {CompileStepFactory, DefaultStepFactory} from './compile_step_factory'; import {Parser} from 'angular2/change_detection'; import {ShadowDomStrategy} from '../shadow_dom/shadow_dom_strategy'; -import { - PropertySetterFactory -} from '../view/property_setter_factory' +import {PropertySetterFactory} from '../view/property_setter_factory'; - /** - * The compiler loads and translates the html templates of components into - * nested ProtoViews. To decompose its functionality it uses - * the CompilePipeline and the CompileSteps. - */ - export class DomCompiler extends RenderCompiler { +/** + * The compiler loads and translates the html templates of components into + * nested ProtoViews. To decompose its functionality it uses + * the CompilePipeline and the CompileSteps. + */ +export class DomCompiler extends RenderCompiler { _templateLoader: TemplateLoader; _stepFactory: CompileStepFactory; _propertySetterFactory: PropertySetterFactory; diff --git a/modules/angular2/src/render/dom/view/property_setter_factory.ts b/modules/angular2/src/render/dom/view/property_setter_factory.ts index be359c3af9..6f13174ab2 100644 --- a/modules/angular2/src/render/dom/view/property_setter_factory.ts +++ b/modules/angular2/src/render/dom/view/property_setter_factory.ts @@ -93,8 +93,8 @@ export class PropertySetterFactory { var dashCasedClassName; if (isBlank(setterFn)) { dashCasedClassName = camelCaseToDashCase(className); - setterFn = (element, value) => { - if (value) { + setterFn = (element, isAdd) => { + if (isAdd) { DOM.addClass(element, dashCasedClassName); } else { DOM.removeClass(element, dashCasedClassName); diff --git a/modules/angular2/test/transform/template_compiler/all_tests.dart b/modules/angular2/test/transform/template_compiler/all_tests.dart index de69ac94e5..fe01d1c922 100644 --- a/modules/angular2/test/transform/template_compiler/all_tests.dart +++ b/modules/angular2/test/transform/template_compiler/all_tests.dart @@ -92,6 +92,18 @@ void allTests() { output = await process(new AssetId('a', inputPath)); _formatThenExpectEquals(output, expected); }); + + it('should create the same output for multiple calls.', () async { + var inputPath = + 'template_compiler/inline_expression_files/hello.ng_deps.dart'; + var expected = readFile( + 'template_compiler/inline_expression_files/expected/hello.ng_deps.dart'); + var output = await process(new AssetId('a', inputPath)); + _formatThenExpectEquals(output, expected); + output = await process(new AssetId('a', inputPath)); + _formatThenExpectEquals(output, expected); + }); + }); } diff --git a/modules/angular2/test/transform/template_compiler/inline_expression_files/expected/hello.ng_deps.dart b/modules/angular2/test/transform/template_compiler/inline_expression_files/expected/hello.ng_deps.dart index cc2c7b5d0d..e9faabb671 100644 --- a/modules/angular2/test/transform/template_compiler/inline_expression_files/expected/hello.ng_deps.dart +++ b/modules/angular2/test/transform/template_compiler/inline_expression_files/expected/hello.ng_deps.dart @@ -14,9 +14,13 @@ void initReflector(reflector) { 'parameters': const [const []], 'annotations': const [ const Component(selector: 'hello-app'), - const View(template: '{{greeting}}') + const View(template: '