As a newcomer to TypeScript, I am seeking assistance on how to access the login service within the authenticate function. Despite using the 'this' keyword to retrieve the login service, it seems ineffective. Additionally, I find myself puzzled by the usage of the 'this' keyword in TypeScript.
import { Constants } from '../../core/constants';
import { loginService } from './login.service';
import { Component, OnInit } from '@angular/core';
import { FormsModule } from '@angular/forms';
@Component({
selector: 'app-login',
templateUrl: './login.component.html',
styleUrls: ['./login.component.css']
})
export class LoginComponent implements OnInit {
constructor(private loginservice: loginService) { }
ngOnInit() {
}
login = {
formData: {
username: '',
password: '',
},
resources:{
login_logo: Constants.LOGO_LOGIN,
},
authenticate() {
console.log("service called");
let resultset = loginservice.authenticateUser(this.formData);
}
}
}