0
I’m having trouble setting up a service for Angularjs, I call a function and when it calls another says it does not recognize as a function what was called
Uncaught TypeError: teste.redirect is not a function
the code I’m using is this:
teste.service('testService', function () {
this.bla = function (a,b){
console.log("ta na function do teste"+ a + " | " + b);
teste.redirect("");
};
this.login = function(pass,user){
var cPass = Sha256.hash(pass);
var cUser = user;
var json = {"user": cUser,"password": cPass};
console.log(json)
consumeService (null, JSON.stringify(json), "login", "POST", "alerta", function(result){
var loginTO = result;
if(loginTO != null){
teste.redirect("logon.html");
}
});
};
this.redirect = function (destiny) {
var url = "http://localhost:8080/web/";
var direct = url + destiny;
if($scope.validateToken()){ window.location(direct);
}else{ window.location(url) ; }
};
Would anyone know where the mistake is?
worked for me, thanks man
– Victor Siqueira