Front-end changes:

app.js: Uinsg $resource

/**
* Created by Answer1215 on 12/9/2014.
*/
'use strict'; function MainCtrl(People) {
var vm = this;
vm.selectedPerson = {}; vm.people = People.query();
vm.selectPerson = function(person) {
var person = People.get({id: person._id}, function() {
vm.selectedPerson = angular.copy(person);
vm.selectedPerson.fullName = person.firstName + " " + person.lastName;
}); } } angular.module('app',[
'ngResource'
])
.controller('MainCtrl', MainCtrl)
.factory('People', function($resource) {
var People = $resource('http://localhost:3000/people/:id', {id: '@id'}, {
update: {
method: 'PUT'
}
}); return People;
});

Server side keep the same.

See last post: http://www.cnblogs.com/Answer1215/p/4187965.html

[MEAN Stack] First API -- 5. Using $resource to setup REST app的更多相关文章

  1. 【百度地图API】如何利用PhoneGap制作地图APP

    原文:[百度地图API]如何利用PhoneGap制作地图APP 摘要:百度地图API是一套由javascript编写的地图程序接口,按说它应该运行在浏览器上.现在,只要利用PhoneGap,我们就能开 ...

  2. 打包APK出现org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:lintVitalRelease'.

    AndroidS Studio打包APK时出现问题:org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':a ...

  3. asp.net mvc 5 web api 关于Requested resource does not support options 问题

    1.用visual studio 2015 建立一个 web api 应用程序.记住这是一个 web api 应用. 2.新建一个web api . 3.用C#访问,代码如下:[没有问题,返回正确] ...

  4. [MEAN Stack] First API -- 3. Select by ID with Mongoose and Express

    Mongoose allows you to easily select resources by ID from your MongoDB. This is an important aspect ...

  5. [MEAN Stack] First API -- 1. with Node.js, Express and MongoDB

    Learn how to import data into your MongoDB and then use Express to serve a simple Node.js API. Impor ...

  6. [MEAN Stack] First API -- 7. Using Route Files to Structure Server Side API

    Currently, the server.js is going way too long. In the real world application, it is likely that we ...

  7. [MEAN Stack] First API -- 6. Using Express route instance

    For server.js, we update the code by using route instance. By using this, we can remove some duplica ...

  8. [MEAN Stack] First API -- 4. Organize app structure

    The app structure: Front-end: app.js /** * Created by Answer1215 on 12/9/2014. */ 'use strict'; func ...

  9. api将一统江湖,再无app

    api的出现,使人们可以通过各种软硬件设备获取所需服务,而不需要安装臃肿的app:今后的智能设备将不再依赖软件.操作系统和硬件,或许一台51单片机都可以提供给用户所需信息.当然连名字都可以简单到不叫a ...

随机推荐

  1. SQL SERVER 实现分组合并实现列数据拼接

    需求场景: SQL SERVER 中组织的数据结构是一个层级关系,现在需要抓出每个组织节点以上的全部组织信息,数据示例如下: ADOrg_ID--------------ParentID------- ...

  2. cocos2d CCLayer 触摸相关

    要让一个  CCLayer 能够接受触摸输入  需要进行如下设置: [selfsetTouchEnabled:YES]; cocos2d-x提供了两种触摸事件处理机制, 分别是CCStandardTo ...

  3. 找出图像I的代数中心

    function centerGPos = cenP(I ) %cenP finds the core of the PSF % [row, col] = find(I > ); minRow ...

  4. convert source code files to pdf format in python

    import os import sys def find_file(root_dir, type): dirs_pool = [root_dir] dest_pool = [] def scan_d ...

  5. SRM 502 DIV1 500pt(DP)

    题目简述 给定比赛时间T和n个题目,你可以在任意时间提交题目,每个题目有一个初始分数maxPoints[i],每个单位时间题目的分数将会减少pointsPerMinute[i],即如果在时间t解决了第 ...

  6. IIS中使用PUT方法錯誤記錄

    在IIS7.5中使用PUT,DELETE方法時會遇到404,405錯誤,特記錄解決辦法:404: 405: 在web.config的system.webServer節點中加入 <modules ...

  7. Web Service学习之六:CXF解决无法处理的数据类型

    CXF不能够处理像Map复杂的数据类型,需要单独转换处理. 总体思路:创建一个转换器和一个对应的可以处理的数据结构类型,将不能处理的类型转换成可以处理的类型: 步骤: 一.创建一个可以处理的类型 举例 ...

  8. Java设计模式系列之命令模式

    命令模式(Command)的定义 将一个请求封装为一个对象,从而可用不同的请求对客户进行参数化:对请求排队或记录日志,以及支持可撤销的操作,将”发出请求的对象”和”接收与执行这些请求的对象”分隔开来. ...

  9. 【转】UIBezierPath精讲

    http://www.henishuo.com/uibezierpath-draw/ 基础知识 使用UIBezierPath可以创建基于矢量的路径,此类是Core Graphics框架关于路径的封装. ...

  10. UVALive 7275 Dice Cup (水题)

    Dice Cup 题目链接: http://acm.hust.edu.cn/vjudge/contest/127406#problem/D Description In many table-top ...