0
我很好奇如何爲單選按鈕組的<input type="radio">
父級div
添加班級?AngulaJS爲活動單選按鈕添加班級到父級
的代碼是下面和JSFiddle is here
HTML:
<div class="bd"> <input type="radio" ng-model="value" value="foo" ng-change='newValue(value)'></div>
<div class="bd active"><input type="radio" ng-model="value" value="bar" ng-change='newValue(value)'></div>
<div class="bd"><input type="radio" ng-model="value" value="baz" ng-change='newValue(value)'> </div>
<hr>
</div>
JS:
var myApp = angular.module('myApp',[]);
function MyCtrl($scope) {
$scope.value= 'foo';
$scope.newValue = function(value) {
console.log(value);
}
}
CSS:
.bd {
border:1px solid red;
width:100px;
float:left;
}
.active{
border:1px solid green;
}