I have LogInController:
[HttpGet("[action]")]
public IActionResult Sample(string email, string password)
{
var user = new SystemUser();
if (user.EmailAddress == email && user.Password == password)
return View();
else return null;
}
And I want to call controller from Angular, something like this:
@Injectable()
export class Authentification {
constructor(private http: HttpClient { }
AuthentificateUser(email: string, password: string) {
return this.http.get('https://localhost:44348/api/LogIn/Sample?email=' + this.email + '&password=' + this.password).subscribe((res: Response) => {
const AuthentificateUser = res.json();
});
}
}
On View I have:
<input ng-model="email" matInput placeholder="Email" formControlName="email">
<input ng-model="password" matInput type="password" placeholder="Password" formControlName="password">
How I can authentificate user on simple and clean way, using Angular 5+ This is trivial, I know, but I have to start from somewhere.
[HttpGet("[action]")]