調用$資源服務從控制器這是獲得服務功能whre我調用API如何在angularJs
.factory('Report', function($resource, API_URL) {
return $resource(API_URL +
'security/:userId/1498780800000/listOfDeliveries', {
userId : '@userId',
expected : '@expected',
arg1 : '@arg1'
}, {
update: {
method: 'PUT'
}
});
})
在app.js我有這個低於控制器
.controller('ReportsController', function($scope, $rootScope,
ProfileData, $state, $timeout, Report) {
})
感謝Fetra ..它的工作..可我知道如何動態傳遞此時間戳參數 – Bhavani
是的,你可以添加像用戶id一個params中,預計: 收益$資源(API_URL + 的安全/:用戶名/:時間戳/ listOfDeliveries',{ 用戶名: '@userId', 時間戳: '@timestamp' ,.... – Fetrarij
我有添加參數時間戳。我是混合應用程序開發新手。你能解釋我爲什麼下面的代碼不起作用嗎? – Bhavani