thoughtram / angular-tabs

Simple tabs component implemented with Angular 2
6 stars 2 forks source link

Issues with ng-repeat #1

Open screenm0nkey opened 9 years ago

screenm0nkey commented 9 years ago

Hey @PascalPrecht ,

When I add a third tab with interpolation, it's treated as a separate entity by ng-repeat. It works in the previous version of the example (before angular switched from @Template to @View). Just wondered if you knew why?

@View({
    template: `
      <tabs>
        <tab [tab-title]="'Tab 1'">Tab 1 Content</tab>
        <tab tab-title="Tab 2">Tab 2 Content</tab>
        <tab [tab-title]="tab3">{{tab3}} Content</tab>
      </tabs>
    `,
    directives: [Tabs, Tab]
})
export class Hello {
    constructor() {
        this.tab3 = 'Tab 3'
    }
}
0x-r4bbit commented 9 years ago

Which ng-repeat are you talking about? There's none in the code. Other than that, this should work.

screenm0nkey commented 9 years ago

My bad. I meant the ng-for <li *ng-for="#tab of tabs" (click)="selectTab(tab)">{{tab.tabTitle}}</li>

When I add the third tab, as above, I end up with;

Tab 1 Tab 2 Tab 3 Tab 1 Content Tab 3 Content

I don't actually know whats causing it but i assumed it was to do with the ng-for.

0x-r4bbit commented 9 years ago

Hm.. could you set up a plunk, so I can further investigate?

screenm0nkey commented 9 years ago

Of course. I'm just at work now but I will endeavour to do so later.

screenm0nkey commented 9 years ago

Hey Pascal, I've added a plnkr here I couldn't get it to run as a plunk as I'm not sure how to configure it. It relies on the traceur-runtime, es6-module-loader-sans-promises etc

screenm0nkey commented 9 years ago

Hey Pascal, as an update, it the interpolation that's causing the issue. So this works <tab [tab-title]="tab3">Content</tab> but this caused the issues <tab [tab-title]="tab3">{{tab3}} Content</tab>