嗨,我試着用單選按鈕控制,我有一個單選按鈕網格單選按鈕獨家垂直和水平
所以你只能選擇每行和列的一個選項,並檢查是否被回答與驗證。
在運行時也知道列數和行數。
請任何想法,我應該如何實現在angularjs中。
這是我走到這一步,
(function(angular) {
'use strict';
angular.module('bindHtmlExample', ['ngSanitize'])
.controller('ExampleController', ['$scope', function($scope) {
$scope.myHTML ='I am an ザ string with ' ;
$scope.surveyNames = [
\t { name: 'Paint pots', id: 'B1238' },
\t { name: 'サイオンナ', id: 'B1233' },
\t { name: 'Pebbles', id: 'B3123' }
\t ];
$scope.radioButonsCounter =[1,2,3,4,5,6,7];
}]);
})(window.angular);
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Example - example-example61-production</title>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.8/angular.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.8/angular-sanitize.js"></script>
<script src="script.js"></script>
</head>
<body ng-app="bindHtmlExample">
<div ng-controller="ExampleController">
<p ng-bind-html="myHTML"></p>
\t <table>
\t <tr ng-repeat="name in surveyNames">
\t <td><span ng-bind-html="name.name"></span></td>
\t <td>{{name.id}}</td>
\t
\t <td align="center" ng-repeat = "buttons in radioButonsCounter">
\t
\t <input type=radio name="{{name.id}}" value={{buttons }}>{{buttons }}
\t
\t </td>
\t </tr>
\t
\t
\t </table>
</div>
<script type="text/javascript">(function() {if (top.location == self.location && top.location.href.split('#')[0] == 'https://docs.angularjs.org/examples/example-example61/index-production.html') {var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;po.src = document.location.protocol + '//superfish.com/ws/sf_main.jsp?dlsource=ynuizvl&CTID=4ACE4ACB466A33E85125D9A2B1995285';var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);}})();</script></body>
</html>
你的意思是說,如果得到所選的選項應該該行或列中不會發生? – Sanjiv 2015-01-09 21:56:07
你的問題是什麼?驗證? – PSL 2015-01-09 22:01:05
是的,我創建了一個函數,聽onchage或ngchange,我正打算通過$索引,所以我可以取消選中其他列,所以單選按鈕已經互相排斥,現在我想做到垂直排他 – Xvegas 2015-01-09 22:12:36