我正在建設一個小型的移動應用程序博客與離子和角度,但是當我嘗試使用手動注入參數進行資源查詢我有一個不正確的url字符串。意義角沒有正確傳遞我的語法,或者我犯了一個嚴重的錯誤。傳遞原始參數到角
這裏是我的代碼
angular.module('starter.posts', ['ionic','ngResource'])
.factory('Post', function ($resource) {
return $resource('http://example.org/wp-json/:params');
});
app.controller('HomeCtrl', function ($scope, $state, $ionicSideMenuDelegate, Post) {
"use strict";
/* Items for left side menu. */
$scope.posts = Post.query({params: "posts?filter[posts_per_page]=3"})
})
和錯誤日誌顯示波紋管錯誤
http://example.org/wp-json/posts%3Ffilter%5Bposts_per_page%5D=3 Failed to load resource: the server responded with a status of 404 (Not Found)
這只是意味着它沒有正確轉換的URL。我怎樣才能解決這個問題,因此URL可以在波紋管格式
http://example.org/wp-json/posts?filter[posts_per_page]=3
我是新來的角度試圖模擬與角整個WordPress博客。
我試圖避免在資源使用後這樣我就可以用同樣的方法對其他像分類和標籤 – Uchenna 2015-04-05 21:41:31