for angular version 1.3.4. In the following snippet , the ng-change event does not work.
dependency: Bootstrap version 3.3.0
The below code works until version 1.2.27
javascript
var app = angular.module("demoApp", ['ngRoute']);
app.controller('DemoController', function ($scope) {
init();
function init() {
$scope.newItemType = 'bill';
$scope.change = function () {
alert($scope.newItemType)
};
}
});
app.config(function ($routeProvider) {
$routeProvider
.when('/prerak/list', {
controller: 'DemoController',
templateUrl: '/app/views/demo.html'
})
});
html
<h4>Demo</h4>
<br />
<div>
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-success">
<input type="radio" value="bill" ng-change="change()" ng-model="newItemType"> Insert New Bill <span class="glyphicon glyphicon-file"></span>
</label>
<label class="btn btn-success">
<input type="radio" value="coin" ng-change="change()" ng-model="newItemType"> Insert New Coin <span class="glyphicon glyphicon-adjust"></span>
</label>
</div>
<br/><br/> Selected Item: <b>{{newItemType}}</b>
</div>
Following is the plunkr (for the simpler version) : http://plnkr.co/edit/yU9unxI8F6u2ToQzlUV2
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…