首页 > Web开发 > 详细

angularjs ajax传参

时间:2016-01-27 19:37:50      阅读:135      评论:0      收藏:0      [点我收藏+]
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="http://apps.bdimg.com/libs/angular.js/1.4.6/angular.min.js"></script>
</head>
<body>

<div ng-app="myApp" ng-controller="customersCtrl"> 

<input type="number" name="num" ng-click="cl()" ng-model=‘num‘>

{{num}}
</div>

<script>
var app = angular.module(myApp, []);
app.controller(customersCtrl, function($scope, $http) {
  $http.get("http://www.runoob.com/try/angularjs/data/Customers_JSON.php", {params: {id:$scope.num}})
  .success(function (response) { alert(response); $scope.names = response.records;});
  
  $scope.cl=function(){
   $http.get("http://www.runoob.com/try/angularjs/data/Customers_JSON.php", {params: {id:$scope.num,key:001}})
  .success(function (response) { alert(response); $scope.names = response.records;});
  
  }
});
</script>

</body>
</html>

 

angularjs ajax传参

原文:http://www.cnblogs.com/tiancai/p/5164225.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!