所以我有一个主模块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
?