Skip to content

Dart: ng-for, ng-if rendered twice #5311

@mark1010

Description

@mark1010

ng-for, ng-if, (ng-?), directives are rendered twice:

dart:

@Component(
    selector: "hello-app",
    template: 'ng-for: <span *ng-for="#thing of things">{{thing}}, </span>',
    directives: const [CORE_DIRECTIVES])
class HelloCmp {
  List things = ['1','2'];
}

output:

ng-for: 1, 2, 1, 2,

version:
dart: Dart VM version: 1.13.0-dev.7.10, (& 1.13.0-dev.7.12 )
angular2: '^2.0.0-alpha.46',
+angular2: Nov 13 17:13:47 2015, commit a31e2f5
+angular2: Nov 17 15:24:36 2015, commit 2c8fcec

Modified dart playground, hello, with ng-if, ng-for.

@Component(
    selector: "hello-app",
    viewProviders: const [GreetingService],
    template:
        '''
        <div *ng-if=show>
          once?
        </div>

        <div>
          things: {{things}}<br/>
          ng-for: <span *ng-for="#thing of things">{{thing}}, </span>
        </div>

        <div class="greeting">{{greeting}} <span red>world</span>!</div>
           <button class="changeButton" (click)="changeGreeting()">change greeting</button>''',
    directives: const [RedDec,CORE_DIRECTIVES])
class HelloCmp {

  bool show = true;
  List things = ['abc','def'];

  String greeting;
  HelloCmp(GreetingService service) {
    this.greeting = service.greeting;
  }
  void changeGreeting() {
    this.greeting = "howdy!!!";
  }
}

result, under Chromium, and in the generated JS output.

once?
once?
things: [abc, def]
ng-for: abc, def, abc, def,
hello world!
change greeting

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions