另一個js函數public方法我創建了定製服務調用從內部供水
(function() {
"use strict";
angular
.module("common.services")
.factory("redirectService",
["$q", "$location",
redirectService])
.config(function ($httpProvider) {
$httpProvider.interceptors.push('redirectService');
});
function redirectService($q, $location){
...
var redirect = function() {
...
};
return {
doRedirect: redirect
};
}
我在那裏我注入這redirectService我試圖調用此發佈doRedirect方法等控制器內部
angular
.module("myModule")
.controller("MyController",
["$scope",
"redirectService"
MyController]);
function MyController(redirectService){
vm.doClick = function() {
redirectService.doRedirect();
}
}
這裏我得到錯誤調用doRedirect方法
Error: redirectService.doRedirect is not a function
難道是loginRedirectService應該重定向服務電話 – Thargor
您創建重定向功能,但嘗試返回redirectPostLogin。或者你錯誤地粘貼了代碼? – speedingdeer