单击AngularJS中的按钮获取选择选项值

时间:2017-11-21 04:28:56

标签: javascript angularjs html-select

我无法获得所选的选项值。

查看

<select class="form-control" ng-model="mySel">
    <option ng-repeat="option in Array" value="@{{ option.id }}">@{{ option.name }}</option>
</select>

<button type="button" class="btn btn-primary" ng-click="getData(mySel);">Select</button>

控制器

scope.getData = function(selectedValue) {
    alert(selectedValue);
}

返回undefined

1 个答案:

答案 0 :(得分:0)

无需从html使用 public class LinkedListLoops { private Node head; private Node tail; public void floydCycle(){ if(node == null) throw new NullPointerException(); Node temp = head; Node fast = head; Node slow = head; while(fast.next != null){ slow = slow.next; if(fast.next.next != null){ fast = fast.next.next; } if(fast == slow){ fast = temp; while(fast != slow){ fast = fast.next; } while(fast.next != slow){ fast = fast.next; } fast.next = null; } } } } 代替

传递selectedValue
ng-model

Working fiddle