angular的http服务的常用方式
来源:互联网 发布:在数据库表中设置null 编辑:程序博客网 时间:2024/05/17 22:57
在实际中的http服务的使用方法,特别注意服务中返回的对象!!!!!
<!DOCTYPE html><html><head><meta charset="UTF-8"><title>http在service中使用</title><script src="day2/src/angular.js"></script></head><body ng-app="app"><div ng-controller="fristController"></div><script type="text/javascript">var app = angular.module('app',[]);app.service('mySerivce',function($http){// 特别注意的是这里返回的对象!!!!!!this.getData = function(){return $http.get('test.json');}})app.controller('fristController',['$scope','$http','mySerivce',function($scope,$http,mySerivce){mySerivce.getData().success(function(data){console.log(data);}).error(function(data){console.log(data);})}])</script></body></html>
0 0
- angular的http服务的常用方式
- angular的$http服务
- angular的http请求方式
- Angular服务的5种创建方式
- angular的http三种请求方式
- angular常用的内建服务
- angular的$interpolate服务
- angular的provider服务
- angular的常用的三种服务 service,factory,provider
- angular中定义服务的三种方式
- angular学习笔记--服务的三种定义方式
- HTTP 常用的请求方式
- $http——ajax跨域请求的angular方式
- Angular的启动方式
- angular中的ng-class的几种常用方式
- angular控制器常用的4种通信方式
- Angular核心服务$http
- HTTP传值方式和请求方式/angular的请求方式
- 1006. 换个格式输出整数 (15)
- Android开发工具——Gradle知识汇总
- PAT-B 1014. 福尔摩斯的约会
- TCP协议如何来保证传输的可靠性
- Patrick and Shopping
- angular的http服务的常用方式
- 将int[]数组转换为字符串
- 百练 4115 鸣人和佐助
- D - Uncowed Forces
- git 相关使用 2
- 编写C模块供Lua使用
- 内纯屏障---__sync_synchronize()
- POJ 2342 - Anniversary party (树形dp)
- Java Object对象的详解