我無法將值從我的選項卡傳遞給me $ scope對象。 這是我的html代碼片段。如何訪問angularJS中的<select>的值
<div ng-controller="RouteController">
<select ng-model="selector" ng-options="opt as opt.label for opt in options">
</select>
<button ng-click="selectFn()">Go</button>
</div>
我的JS代碼如下。
sampleApp.controller('RouteController', function($scope){
$scope.options=[
{label: '1', url:'1.html'},
{label: '2', url:'2.html'}
];
$scope.selectFn = function($scope){
alert("selector");
}
});
我不確定如何將選定項目的值傳遞給警報。
謝謝Serhan,工作! –
很高興幫助@Vedant –