habe ich individuelle ServiceAufruf öffentliche Methode von einer anderen js Funktion in Service
(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
};
}
in meinem anderen Controller, wo ich diese redirectService bin Injektion Ich versuche, diese doRedirect Methode aufrufen veröffentlichen
angular
.module("myModule")
.controller("MyController",
["$scope",
"redirectService"
MyController]);
function MyController(redirectService){
vm.doClick = function() {
redirectService.doRedirect();
}
}
Hier erhalte ich Fehler beim Aufruf doRedirect Methode
Error: redirectService.doRedirect is not a function
Könnte es sein, dass loginRedirectService Redirect sein sollte Service beim Anruf – Thargor
Sie erstellen Redirect-Funktion, aber versuchen Sie redirectPostLogin zurückzugeben. Oder Sie haben den Code einfach falsch eingefügt? – speedingdeer