typescript - How to implement a variable for an array (Angular 4) -


i'm trying right value skill.team[variable here].name angular gets team name skill

here's code:

html

<select [(ngmodel)]="skill.teams[1].name" name="teamname" id="teamname" class="form-control">                     <option *ngfor="let skill of skills" [value]="skill.teams[1].name">{{ skill.teams[1].name }}</option>                   </select>  

array

skill = {   _id:'',   name:'',   teams:[{name:'team1'},{name:'team2'}] }  

i believe you're looking for; should iterating on skill.teams array *ngfor. changes model skill.name, however, may or may not you're looking for.

<select [(ngmodel)]="skill.name" name="teamname" id="teamname" class="form-control">         <option *ngfor="let team of skill.teams" [value]="team.name">{{team.name}}</option> </select>   

Comments

Popular posts from this blog

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -

python - Error while using APScheduler: 'NoneType' object has no attribute 'now' -