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

如何使用angularjs实现按钮事件

2016-01-30 15:12 706 查看
<!DOCTYPE html>
<html ng-app="myApp">
<head>
<title>angularjs-setValue</title>
</head>
<body ng-controller="body">
<input type="text" name="input1" ng-model="input1"><br />
<input type="text" name="input2" ng-model="input2"><br />
<input type="button" ng-click="clickEvent()" value="按钮">
<script type="text/javascript" src="js/angular.min.js"></script>
<script type="text/javascript">
var myApp = angular.module('myApp',[]);
myApp.controller('body', function($scope){
$scope.clickEvent = function() {
alert("input1:" + $scope.input1);
alert("input2:" + $scope.input2);
}
});
</script>
</body>
</html>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: