From the course: Building Angular and ASP.NET Web API Apps
Unlock the full course today
Join today to access over 22,400 courses taught by industry experts or purchase this course individually.
Creating an Angular login component
From the course: Building Angular and ASP.NET Web API Apps
Creating an Angular login component
- [Instructor] We have seen so far how to register a user, and how to log out a user. But if we want to log in using the credentials of an existing user, that is not possible at the moment. So, on this part, we are going to start implementing the user login feature. And to do so, we will first create a component using the angular CLI. Add the component to the routing module, and then we will design the view. And then at the end we are going to send a request to our back end API. So, let's get started. In our angular project, open the terminal, and in here type ng generate a component named login, and then configure this component in our app module file. And then press enter. So in the source folder, inside the app folder, you are going to see a new component, the login component. Now to be able to use this component, we need to configure it in our router module, so for that go to the app-router.module.ts file. In here, import the new components of import, login component, and then…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
-
-
Setting up AuthController5m 10s
-
Setting up AuthService3m 8s
-
Creating a register component5m 6s
-
Registering users6m 18s
-
Generating a token6m 53s
-
Requesting a token from Angular4m 42s
-
Authentication check via tokens5m 11s
-
Logging out users1m 54s
-
Creating an Angular login component4m 47s
-
Getting data from the login form4m 25s
-
Logging in users4m 20s
-
Handling errors in angular4m 2s
-
-
-