Сообщение от One_Two
|
ng-ckecked по дефолту не ставится.
|
Сообщение от One_Two
|
$scope.radioVal = '';
|
<!DOCTYPE html>
<html ng-app="myApp">
<head>
<title>Modal</title>
<meta charset="utf-8">
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.6/angular.min.js"></script>
<script>
angular.module('myApp', []);
angular.module('myApp').controller('myCtrl', function($scope) {
$scope.arrs = []; $scope.radioVal = 'def';
$scope.add = function(){
$scope.arrs.push({radio:$scope.radioVal});
$scope.radioVal = 'def';
console.log($scope.arrs);
};
console.log($scope.arrs);
});
</script>
</head>
<body ng-controller="myCtrl">
<div>
<button ng-click="showBlock = ! showBlock">Кнопка</button>
</div>
<div ng-show="showBlock">
<input type="radio" ng-model="radioVal" value="def" ><span>Дефолт</span><br>
<input type="radio" ng-model="radioVal" value="1"><span>1</span><br>
<input type="radio" ng-model="radioVal" value="2"><span>2</span><br>
<button ng-click="add()">Отправить</button>
</div>
</body>
</html>