Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70612

Ionic 2 segment not working with Angular directives

$
0
0

@Nodon wrote:

Hi,
i trying to create dynamic generated Ionic 2 segment buttons, but everytime when i use some of Angular directives, it fail. I see segments buttons, but click doesnt change anything including ngModel variable. See example:

Working static example:

<ion-segment [(ngModel)]="subsActiveDay">
    <ion-segment-button value="2016-03-01T00:00:00.000Z">
        1
    </ion-segment-button>
    <ion-segment-button value="2016-03-02T00:00:00.000Z">
    2
    </ion-segment-button>
</ion-segment>
{{subsActiveDay}}

Not working:

<ion-segment [(ngModel)]="subsActiveDay">
    <ion-segment-button *ngFor="#day of subs" [value]="day.date">
        {{day.datestamp | date}}
    </ion-segment-button>
</ion-segment>
{{subsActiveDay}}

In second example buttons are generated, but there is no default selected button and subsActiveDay variable doesn't change after click. I tried to figure out ngFor and use two test variables defined in component for value, but result was fail too.

Any ideas where could be problem?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70612

Trending Articles