Building a login page with Angular
The login page represents the other half of our user authentication feature. We have an authentication API; now, we need the form to input our username and password. We will build this user interface in Angular using ngForm
, our current user service, and Observables for data-binding.
Getting ready
Before we can get started building our login page, we will need to generate a new login component to handle our login user experience. We will create that using Angular CLI's generate
command:
ng generate component login
We will also need to remove any previous usage of the CurrentUserService
service from our application. The main place we had used it previously was the /src/app/app.module.ts
module. Ensure that the main module class export does not do anything with the CurrentUserService
provider by removing its reference from the module.
We will also need to make sure that our LoginComponent
component and Angular2FontawesomeModule
are loaded in our application module...