angularJs select绑定的model取不到值

版权声明: https://blog.csdn.net/LPLIFE/article/details/82013305

 前端直接绑定值,不传参数,controller中会一直取到初始化的值,无法实时获取前端select改变的值。

 解决办法1:前端调用方法的时候,一边传参数(亲测可用)

<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'}];

猜你喜欢

转载自blog.csdn.net/LPLIFE/article/details/82013305