Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When I tried "ng serve" with angular 9, it is saying "error" field doesn't exist in login.component.ts #236

Open
Bhaskar1312 opened this issue Jul 27, 2020 · 2 comments

Comments

@Bhaskar1312
Copy link

Property 'error' does not exist on type 'LoginComponent'.

1 <div class="alert alert-danger" [hidden]="!error">...

..with files login.component.ts and login.component.html

@jeffreyhilaire
Copy link

jeffreyhilaire commented Jul 27, 2020

Sounds like the "error" variable does not exist in login.component.ts ?

@ssjlee93
Copy link

This is what I did:

login.component.ts

export class LoginComponent {
  // added a new variable 
  error = "";

  credentials = {username: '', password: ''};

  constructor(private app: AppService, private http: HttpClient, private router: Router) {
  }

  login() {
    this.app.authenticate(this.credentials, () => {
        this.router.navigateByUrl('/');
    });
    return false;
  }

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants