所以我有一個主模塊app
定義爲配置在AngularJS restmod的子模塊
app = angular.module("app", ['app.social_accounts', 'restmod'])
有其restmod
模塊,配置:
app.config(function(restmodProvider) {
restmodProvider.rebase({
$config: {
primaryKey: "id",
style: "ams",
urlPrefix: "/app/"
}
});
});
,它按預期工作:請求被送到http://localhost:8000/app/...
現在我想在子模塊app.social_accounts
中使用restmod
,通過做
app = angular.module("app.social_accounts", ['restmod'])
app.config(function(restmodProvider) {
restmodProvider.rebase({
$config: {
primaryKey: "id",
style: "ams",
urlPrefix: "https://graph.facebook.com/"
}
});
});
app.factory("Album", ["restmod", function(restmod){
Album = restmod.model("/me/albums/")
return {
"get": function(){Album.$search()}
}
}])
即我想在子模塊app.social_accounts
使用絕對url
。
但是,當我注入Album
(app.social_accounts
下注冊)到一個controller
DashboardCtrl
app
下,該請求被送到http://localhost:8000/app/me/albums/
。
所以我想知道這裏發生了什麼,以及如何在app.social_accounts
下如何實現restmod
的單獨url
?