use MongoDB ObjectId as unique IDs

This commit is contained in:
Davide Alberani 2015-03-21 20:31:36 +01:00
parent 8a1834e509
commit 1c993c147c
4 changed files with 6 additions and 5 deletions

View file

@ -17,7 +17,7 @@
<ul class="events"> <ul class="events">
<li ng-repeat="event in events | filter:query | orderBy:orderProp"> <li ng-repeat="event in events | filter:query | orderBy:orderProp">
<span><a href="/#/events/{{event.id}}">{{event.title}}</a></span> <span><a href="/#/events/{{event._id}}">{{event.title}}</a></span>
<p>{{event['begin-datetime']}}</p> <p>{{event['begin-datetime']}}</p>
</li> </li>
</ul> </ul>

View file

@ -3,6 +3,7 @@
/* Controllers */ /* Controllers */
var eventManControllers = angular.module('eventManControllers', []); var eventManControllers = angular.module('eventManControllers', []);
eventManControllers.controller('navigation', ['$location', eventManControllers.controller('navigation', ['$location',
function ($location) { function ($location) {
this.go = function(url) { this.go = function(url) {

View file

@ -2,7 +2,7 @@ var eventManServices = angular.module('eventManServices', ['ngResource']);
eventManServices.factory('Event', ['$resource', eventManServices.factory('Event', ['$resource',
function($resource) { function($resource) {
return $resource('events/:id', {id: '@id'}, { return $resource('events/:id', {id: '@_id'}, {
all: { all: {
method: 'GET', method: 'GET',
isArray: true, isArray: true,
@ -18,10 +18,10 @@ eventManServices.factory('Event', ['$resource',
eventManServices.factory('Person', ['$resource', eventManServices.factory('Person', ['$resource',
function($resource) { function($resource) {
return $resource('persons/:id', {id: '@id'}, { return $resource('persons/:id', {id: '@_id'}, {
all: { all: {
method: 'GET', method: 'GET',
isArray:true, isArray: true,
transformResponse: function(data, headers) { transformResponse: function(data, headers) {
return angular.fromJson(data).persons; return angular.fromJson(data).persons;
} }

View file

@ -17,7 +17,7 @@
<ul class="persons"> <ul class="persons">
<li ng-repeat="person in persons | filter:query | orderBy:orderProp"> <li ng-repeat="person in persons | filter:query | orderBy:orderProp">
<a href="/#/persons/{{person.id}}"><span>{{person.name}}</span>&nbsp;<span>{{person.surname}}</span></a> <a href="/#/persons/{{person._id}}"><span>{{person.name}}</span>&nbsp;<span>{{person.surname}}</span></a>
<p>{{person.email}}</p> <p>{{person.email}}</p>
</li> </li>
</ul> </ul>