Issue
I was just following an udemy tutorial when suddenly, these errors appeared: Unexpected keyword or identifier.
, Member 'console' implicitly has an 'any' type.
, Unexpected token. A constructor, method, accessor, or property was expected.
, 'log', which lacks return-type annotation, implicitly has an 'any' return type.
, Identifier expected.
. Here`s my innocent line 10 code: console.log('example');
Can someone explain what happened?
Edit: Here's my code:
import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root'
})
export class HardcodedAuthenticationService {
constructor() { }
console.log('example');
authenticate(username: any, password: any) {
if (username !== '' && password !== '') {
sessionStorage.setItem('authenticatedUser', username)
return true;
}
return false;
}
isUserLoggedIn() {
let user = sessionStorage.getItem('authenticatedUser');
return !(user === null)
};
}
Also this is a service
Solution
I needed to put the console log in authenticate()
. I am so sorry!
Answered By - berriz
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.