angularjs向后台传递数据,与后端进行交互

angularjs之数据交互

 

function loadLeftFirstNodes (){
    $http.get(sourceUrl,{
        params:{
             mpId: mpId,
             visits: centerVisits,
             stepNum: centerStepNum-1,
             path:path,
  	     url:centerUrl,
  	     stDate:stDate,//startDate,
  	     edDate:edDate//endDate
	 }
     }).success(function(json){
		leftFirstDatas = json;
        }                       

 

  其中sourceUrl是与后端进行数据通信的接口,从这个接口就可以拿到后台传来的数据;params对象是向后台发送的数据,及前端需要的哪些数据,success方法里面是数据成功时所得到的数据,最后将数据展示到页面中。

 

posted @ 2016-06-23 10:48  一人的代码  阅读(2278)  评论(0编辑  收藏  举报