javascript - angular 如何实现点击option跳转
本文介绍了javascript - angular 如何实现点击option跳转的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
问 题
option是ng-repeat生成的
解决方案
<div ng-repeat = "item in items">
<p ng-click="someFun(item)">{{item.name}}</p>
</div>
一般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 >
如解决了问题,请点赞采纳~
这篇关于javascript - angular 如何实现点击option跳转的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文