AngularJS RESTful $resource服务
2014-04-15 21:09
218 查看
我们如果要使用$resource服务,先要引用resource文件
在模块里面拿到数据
再利用模块注入的形式
在模块里面注入是使用
在模块里面拿到数据
再利用模块注入的形式
angular.module('phonecatServices', ['ngResource']). factory('Phone', function ($resource) { return $resource('contact/phone.json', {}, { query: { method: 'GET', params: { id: 'phones' }, isArray: true } }); });
在模块里面注入是使用
angular.module("news", ['ngRoute', 'phonecatServices']). config(['$routeProvider', function ($routeProvider) { $routeProvider. when('/', { templateUrl: 'partials/list.html', controller: newsListController }). when('/news/:id', { templateUrl: 'partials/detail.html', controller: newsDetailController }). otherwise({redirectTo:'/'}); } ]);
相关文章推荐
- 我的文品指数 搜狗的新服务
- 关于IT服务:服务是需要不断改进和培训之如何去做解答?(故事三)
- xp服务优化(转贴)
- windows Apache Service Monitor 配置多个服务站点
- Spring flex 搭建服务 之 架构原理(BlazeDS)和服务配置方法 (第一章)
- 打印系统服务也玩新花样
- E-Health使用微软云计算解决方案,大大降低了成本并提高了服务
- 使用Intent启动常用的应用与服务
- win7系统组件中无法安装IIS和FTP服务的解决办法
- Android在init.rc中加入脚本开机安装APK并启动APK的服务
- [Android开发入门]调用系统服务之Manager的使用(一)
- C#创建windows服务程序,并制作windows服务安装包。
- Android绑定方式开始服务&调用服务当中的方法
- 易宝典文章——玩转Office 365中的Exchange Online服务 之二十二 ExchangeOnline关于垃圾邮件的判定标准
- 马哥2016全新Linux+Python高端运维班-Linux服务 DNS,httpd,加密通讯,vsftp,NFS,samba服务练习
- 1.3:每个对象都提供服务
- 轻量级的.NET对象查找服务和AOP开发框架Netop.Core源码解说(5)--其它
- linux备忘录-系统服务daemon
- Timer与TimerTask的基本API,以及服务运行时改变调度时间
- (转)SpringBoot之退出服务(exit)时调用自定义的销毁方法