【发布时间】:2016-10-20 03:39:53
【问题描述】:
这是我的下拉菜单,当我更改选项时会提醒它的工作,但是当我再次选择相同的选项时我没有得到提醒。它是如何可能的
index.html
<body ng-app="demoApp">
<div ng-controller="DemoController">
<div>
<select ng-model="currentlySelected" ng-options="opt as opt.label for opt in options" ng-change="logResult()">
</select>
The value selected is {{ currentlySelected.value }}.
</div>
</div>
</body>
app.js
angular.module('demoApp', []).controller('DemoController', function($scope) {
$scope.options = [
{ label: 'one', value: 1 },
{ label: 'two', value: 2 }
{ label: 'three', value: 3 }
{ label: 'four', value: 4 }
{ label: 'five', value: 5 }
];
$scope.currentlySelected = $scope.options[1];
$scope.logResult = function() {
alert($scope.currentlySelected);
}
});
我期望的是,如果我选择“两个”两次,我需要提醒两次。这是可能的还是我应该为此使用不同的指令?
【问题讨论】:
标签: html angularjs angularjs-scope