1
我試圖做出在Rails API相匹配這些路線的AngularJS $resource
:
search_notes GET /notes/search/:term(.:format) lesson_notes/notes#search
notes GET /notes(.:format) lesson_notes/notes#index
POST /notes(.:format) lesson_notes/notes#create
note GET /notes/:id(.:format) lesson_notes/notes#show
PATCH /notes/:id(.:format) lesson_notes/notes#update
DELETE /notes/:id(.:format) lesson_notes/notes#destroy
這是我現在,這不工作:
LessonNotes.factory("Note", ["$resource", function($resource) {
return $resource("lesson_notes/notes/:id:action/:term", {
id: "@id",
action: "@action",
term: "@term"
}, {
query: { method: 'GET', params: {}, isArray: true },
update: { method: 'PATCH' },
destroy: { method: 'DELETE' },
search: { method: 'GET', params: {
action: 'search',
term: '@term'
},
isArray: true
}
});
}
]);
這裏是我的錯誤:我的服務成立心病
"NetworkError: 404 Not Found - http://localhost:3000/lesson_notes/notes/search?0=i&1=n&2=t&3=r&4=o&5=d&6=u&7=c&8=e"