扫码关注官方订阅号
option是ng-repeat生成的
人生最曼妙的风景,竟是内心的淡定与从容!
<p ng-repeat = "item in items"> <p ng-click="someFun(item)">{{item.name}}</p> </p>
一般select的option是用ngOptions
<select ng-model="myColor" ng-options="color.code as color.name for color in colors"></select>
而你说option是用ng-repeat生成的,那么就变成了
<select> <option ng-repeat = "item in items" ng-click="someFun(item)">{{item.name}}</option> </select >
如解决了问题,请点赞采纳~
<label ng-repeat="item in data">
<input type="radio" value="{{item.name}}" name="radio" ng-click="optClick(item)" /> {{item.name}}
</label>
$scope.data = [{
name: "aaa" }, { name: "bbb" }, { name: "ccc" }, { name: "ddd" }, { name: "eee"
}];
$scope.optClick = function(item) {
console.log(item.name) //...
}
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
一般select的option是用ngOptions
而你说option是用ng-repeat生成的,那么就变成了
如解决了问题,请点赞采纳~
<label ng-repeat="item in data">
</label>
$scope.data = [{
}];
$scope.optClick = function(item) {
}