angularJS의ng-click과ng-change

1344 단어
<!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");
  			}
		}
	}]);

이상 코드는 오랫동안 고민되었습니다.

좋은 웹페이지 즐겨찾기