ng-model 不能像这样工作:plunker link
我尝试提醒 ng-model="selectedFriend"并期望弹出 friend 的姓名,但是当它在 Angular Bootstrap ui 的选项卡内容中使用时出现问题。
<select ng-model="friendsModel" ng-options="friend.name for friend in myFriends.friends.data">
<option value="">Select friend</option>
</select>
我怀疑这是 $scope 问题,因为它在这里工作正常 plunker link
最佳答案
选项卡正在创建一个新范围,因此您需要在 ng-model
表达式中添加一个“著名的点”。这些与作用域相关的问题很常见,即使使用 ngInclude
等内置指令,您也可以观察到它们。
最后,这是一个有效的 plunk:http://plnkr.co/edit/PPGA8SBwHeEQNAQCZT3K?p=preview
关于javascript - ng-model 在 Angular Bootstrap ui 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23494553/