码迷,mamicode.com
首页 > Web开发 > 详细

如何使用angularjs实现按钮事件

时间:2016-01-30 17:59:04      阅读:207      评论:0      收藏:0      [点我收藏+]

标签:

<!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>

 

如何使用angularjs实现按钮事件

标签:

原文地址:http://www.cnblogs.com/modou/p/5171104.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!