用回调解决angular service 异步传输数据到controller中
来源:互联网 发布:蓝点网络 编辑:程序博客网 时间:2024/05/17 06:18
.factory('test',["$http",function($http){
var testObject = {
data:{},
cb:function(){}
};
$http.get("/testRouter").then(function(err, data){
testObject.data = {"test":"test"};
testObject.cb();
}, function(msg){
testObject=msg;
});
return testObject;
var testObject = {
data:{},
cb:function(){}
};
$http.get("/testRouter").then(function(err, data){
testObject.data = {"test":"test"};
testObject.cb();
}, function(msg){
testObject=msg;
});
return testObject;
}])
.controller("fundrecordCtrl",["socket","$scope","$http","test",function(socket,$scope,$http,test){
test.cb = function(){
console.log(test.data);
}
}])
..................................................................................
router.get("/testRouter",function(req,res,next){
res.send({"testRouter111":"todfggh"});
})
0 0
- 用回调解决angular service 异步传输数据到controller中
- JAVA异步回调解析
- angularjs调用springmvc action时,访问到action但是数据不能正确返回到angular controller中
- ajax异步回调解析List集合
- 关于angular中controller和指令交互数据:@
- angular 在controller中共享数据的几种方式
- 通过JS回调解决异步请求中断执行的问题
- angular如何组织controller directive service
- Controller向View传输数据
- angular js中service
- angular中controller、directive等为什么要用function包起来
- 传输List数据到jtable中
- php编程中$.post()数据的异步传输。。。
- h5+中iOS调用plus.runtime.launchApplication不执行失败回调解决办法
- angular js 中异步加载
- angular中,controller、directive和factory
- angular中controller之间的通信
- 使用接口回调解析数据并下载网络图片
- ViewPager的使用2
- iOS 自定义TabBarController
- 关于 UIWebView 加载后为空白页
- 深度学习(五)caffe环境搭建
- 系统中打开GPS和关闭GPS
- 用回调解决angular service 异步传输数据到controller中
- opencv编程笔记
- iOS导航栏的translucent属性
- webx返回json类型数据
- 21.Merge Two Sorted Lists
- 深度学习(六)caffe入门学习
- MFC使用WM_HOTKEY添加快捷键
- 实现图片Bitmap简单编辑的三种方式
- JNI:Java Native Interface