this part is the component where I am receiving a json. it contains the number.
public loginA(){
this.loginService.login(this.usuario).subscribe(
datos => {return datos['id']}
);
}
The value that data ['id'] shows me there can be 1 or -1 but I can't return it to this guard
export class LoginGuard implements CanActivate {
constructor(private loginComponent:LoginComponent){}
canActivate(){
if(this.loginComponent.loginA()>0){
return true;
}else{
return false;
}
}
}
here it gives error this.loginComponent.loginA() because it is not returning anything