您的位置:首页 > Web前端 > AngularJS

angularJS中的ng-click和ng-change

2015-08-25 15:35 603 查看
<!doctype html>
<html ng-app="RadioExample">
    <head>
        <meta charset="utf-8">
    </head>
    <body>
        <div>
            <input ng-model="greeting.text"/>
            <p>{{greeting.text}},AngularJS</p>
        </div>

        <div>
	        <form name="myForm" ng-controller="TestController">
	        	<input ng-model="test" type="radio" value="0" ng-change="a()" /> 0
	              
	            <input ng-model="test" type="radio" value="1" ng-change="a()"/> 1
	        </form>
        </div>
    </body>
    <script src="js/angular-1.3.0.js"></script>
    <script type="text/javascript" src="js/FuckController.js"></script>
</html>


var testFuck = angular.module('RadioExample', [])
	.controller('TestController', ['$scope', function($scope)
	{
		$scope.a=function()
		{
  			if ($scope.test == "1")
  			{
  				alert("1");
  			}

  			if ($scope.test == "0")
  			{
  				alert("0");
  			}
		}
	}]);


以上代码纠结了好久,==晚上更新
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: