Issue
How can i clear radio buttons checked status when click on 'clear' buttons ?
Listing radio buttons in ng-repeat,
<label ng-repeat="item in items">
<input type="radio" name="test" ng-model="test" value="{{item.name}}" />{{item.name}}
</label>
<a class="undo" ng-click="clear()">Clear</a>
And is it possible clear checked status from another controller ?
Solution
This will works fine..!!!
angular.module("myApp", []).controller("Example", ["$scope", function($scope) {
$scope.data = {};
$scope.items = [
{name: 'one'},
{name: 'two'},
{name: 'three'},
{name: 'four'},
{name: 'five'},
];
$scope.clear = function(){
$scope.data = {};
//alert("hello");
}
}]);
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.12/angular.min.js"></script>
<div ng-app="myApp" ng-controller="Example">
<label ng-repeat="item in items">
<input type="radio" name="test" ng-model="data.test" value="{{item.name}}" />{{item.name}}
</label>
<br>
<a class="undo" ng-click="clear()">Clear</a>
</div>
Answered By - chandrakant
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.