In Angular 6, I have created a LoginService like this:
@Injectable()
export class LoginService {
constructor(private http: HttpClient) { }
login(): Observable<boolean> {
var url = `${environment.baseAPIUrl}${environment.loginUrl}`;
return this.http.get<boolean>(url);
}
}
Now, I am calling this service from my LoginComponent:
@Component({
selector: 'bpms-login',
templateUrl: './login.component.html',
styleUrls: ['./login.component.scss']
})
export class LoginComponent implements OnInit {
constructor(private loginService: LoginService) { }
ngOnInit() {
}
login() {
var self = this;
self.loginService.login();
}
}
I am facing an issue where my request is not being sent. Any idea why?