Getting object properties via ngModel select list in Angular 2?

前端 未结 2 2152
情歌与酒
情歌与酒 2020-12-15 19:23

I\'m have a problem fetching the properties of an object which has been selected from a select list in Angular 2 (RC1). Take the following syntax:


    
    

Component Class

setPlan(value) {
    //if you're on older versions of ES, use for-in instead
    var plan = this.plans.find(p => p.name = value);

    if(plan) { this.model.plan = plan; }
}

Couldn't try it, for some reason plunkr has never worked for me.

提交回复
热议问题