angularJs select绑定的model取不到值的解决方法
2019/6/26 23:25:36
本文主要是介绍angularJs select绑定的model取不到值的解决方法,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
前端直接绑定值,不传参数,controller中会一直取到初始化的值,无法实时获取前端select改变的值。
解决方法一:前端调用方法的时候,一边传参数(亲测可用)
<select ng-model="speed" name="speed" ng-change="vm.h5Video().Playspeed(speed)> <option value="1" selected="selected">x1</option> <option value="1.5">x1.5</option> <option value="2">x2</option> <option value="4">x4</option> </select>
解决方法二:把所有值放在controller中,前端循环输出。
$scope.selects = [{id:'1',name:'x1'},{id:'1.5',name:'x1.5'},{id:'2',name:'x2'}];
以上这篇angularJs select绑定的model取不到值的解决方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持找一找教程网。
这篇关于angularJs select绑定的model取不到值的解决方法的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-03-30[OIDC in Action] 2. 基于OIDC(OpenID Connect)的SSO(纯JS客户端)
- 2024-03-29terraform jsonencode
- 2024-03-13vuex-persist
- 2024-03-11icons for vue
- 2024-03-07breadcrumbs react js
- 2024-03-06react login page example
- 2024-03-06react router uselocation
- 2024-03-04postgres jsonb_set
- 2024-03-01react native uuid
- 2024-02-29vuejs sidebar