简体   繁体   中英

ng-model undefined in nested drop-down in ng-repeat

I'm new to Angular and I try to code a page to create teams and assign players to those teams. I put a select tag to select a player to add to the team. I've created a Fiddle with the problem . I think there is a $scope issue, but i don't see what it can be. Any ideas?

The issue is that you are using ng-model="selectedPlayer[team.name]" without setting selectedPlayer in scope at all. To use it like this you first need to create variable $scope.selectedPlayer = {};

Working jsfiddle: http://jsfiddle.net/L721ap6d/1/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM