talking ischeap,show me the code(不要逼逼,直接看代码)
Angular Radio测试
运行效果
感谢@crazy4x 的评论,JS代码改成下面这样就可以了!
<script type="text/javascript"> var testObj = angular.module('testApp',[]); testObj.controller("testCtr",function($scope){ $scope.orgTypes = ['其他','医院','养老院']; $scope.viewModel.orgType = $scope.orgTypes[0]; }); </script>
写了之后,Angular遍历出错了
TypeError: Cannot set property 'orgType' of undefined at new <anonymous> (test4NgRadio.html:24) at Object.invoke (angular.js:4862) at $controllerInit (angular.js:10717) at nodeLinkFn (angular.js:9594) at compositeLinkFn (angular.js:8903) at compositeLinkFn (angular.js:8906) at publicLinkFn (angular.js:8768) at angular.js:1847 at Scope.$eval (angular.js:18017) at Scope.$apply (angular.js:18117)
$scope.viewModel={ orgType = $scope.orgTypes[0] }