我无法使用带有Ionic 1.1.1的AngularJS 1.4.7检索Radio组的值;Ionic AngularJS Radio Group ng-model issue using ion-radio
任何想法都会很棒,谢谢。
看到问题的codepen片段:http://codepen.io/angsar/pen/RWdvrO
HTML
<html ng-app="app">
<head>
<link rel="stylesheet" href="http://code.ionicframework.com/1.1.1/css/ionic.min.css" />
<link href="http://code.ionicframework.com/ionicons/1.5.2/css/ionicons.min.css" rel="stylesheet">
<script src="http://code.ionicframework.com/1.1.1/js/ionic.bundle.js"></script>
</head>
<body ng-controller="myCtrl">
<ion-content padding="true">
<form class="list" ng-submit="Pass(test)">
<p>Selected Sample: {{test.val}}</p>
<ion-radio ng-model="test.val" ng-value="s1">Sample 1</ion-radio>
<ion-radio ng-model="test.val" ng-value="s2">Sample 2</ion-radio>
<button class="button button-energized button-large icon-right button-full">Test</button>
</form>
</ion-content>
</body>
</html>
的Javascript
angular.module('app', ['ionic'])
.controller('myCtrl', function($scope) {
$scope.Pass = function($test) {
alert("Test: "+$test.val);
}
});
或者你可以在你的''
添加'NG-的init = “测试= {}”'工作codepen:http://codepen.io/anon/pen/Lpaqra – konqi
并与ng-init:http://codepen.io/anon/pen/vNPbzB – konqi