Hi,
I am using angular *2.0.0-rc.5 *with material *2.0.0-alpha.7-2* and have an
HTML template that includes a dynamically generated radio group as follows:
<md-radio-group name="frequency" [(ngModel)]="frequency">
<md-radio-button value="{{frequency.name}}" *ngFor="let frequency of
frequencies">{{frequency.description}}</md-radio-button>
</md-radio-group>
I would like to perform some additional action whenever the use selects one
of the radio options.
I have achieved this by adding a listener on the *change* event as follows:
<md-radio-group name="frequencyGroup" [(ngModel)]="selectedFrequency" (
change)="doAction()">
<md-radio-button value="{{frequency.name}}" *ngFor="let frequency of
frequencies">{{frequency.description}}</md-radio-button>
</md-radio-group>
However I feel that there must be a better way of achieving this. Does
anyone have any insights on how best to achieve this in angular?
I have created a simple plunk that logs the selected option to the console
here: Plunker Demo <http://plnkr.co/edit/EN4OieEDCxLX6lbnsy4U>
Thanks in advance.
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.