Ionic segment not working with Angular directives


#1

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?


#2

I have the same problem and I put the event
(click)="subsActiveDay=day.date"
on ion-segment-button


#3

Same problem for me, any chance this is being fixed soon? It’s a bit ugly to manage ion-segment-button click event TBH