From the course: Angular: API Communication and Authentication

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Implementing a user login

Implementing a user login - Angular Tutorial

From the course: Angular: API Communication and Authentication

Start my 1-month free trial

Implementing a user login

- [Instructor] Now that we have the auth service, we need to go ahead and implement a login form. Let's first generate a login component. Pop in the terminal here, and you generate a component, and this component will be the login component. And we can see here in our files, that the login component has been generated. We need to go ahead and add it to the routing module. First let's import this component. This is the LoginComponent from /Login/login.component. We will be adding a new route. The path for this would be 'login', and at this route, we want to render the LoginComponent. Head over now, to the generated component files, and open up the html file. We need to write the markup here. This log form will first be wrapped in a container. We will need a form, and similar to the add contact component, we need to create a local template variable, and assign it the value of the ngForm object. When the form is submitted, we call the onSubmit method on this component, along with the…

Contents