Difference between revisions of "Creating a Login Page Using the 'ace-login-form' Component"

From AgileApps Support Wiki
Line 7: Line 7:
If the Angular App is created as per the above guidelines, use the following Angular CLI command to create a login page and login component in the application.
If the Angular App is created as per the above guidelines, use the following Angular CLI command to create a login page and login component in the application.


1. Navigate to the '''''hello-cui''''' App directory and run the following command to create a login module inside the app:
1. Navigate to the '''''hello-cui''''' App directory and run the following command to create a login module inside the app:<br>
<code>
<code>
ng generate module login --route login --module app.module
ng generate module login --route login --module app.module

Revision as of 09:18, 7 February 2023

You can create a custom login page by using ace-login-form component available in ace-lib.

Prerequisites

Create an angular CUI template app by following the instructions present in the Creating an Angular Project for the CUI Template page.

Steps

If the Angular App is created as per the above guidelines, use the following Angular CLI command to create a login page and login component in the application.

1. Navigate to the hello-cui App directory and run the following command to create a login module inside the app:
ng generate module login --route login --module app.module
2. Open the newly created login.component.html and paste the following login component tag into it.
<ace-login-form css-classlist="ace-bg-white"></ace-login-form>

Notepad.png

Note: Add additional HTML tags outside the above tag and CSS classes if required to beautify and align the login component.

3. Handle the loginSuccess event by performing the following changes to the login.component.html and login.component.ts:

login.component.html

Authentication Required

       <ace-login-form css-classlist="ace-bg-white" (loginSuccess)="loginSuccessHandler($event)"></ace-login-form>


login.component.ts
import { Component, OnInit } from '@angular/core'; @Component({

selector: ‘app-login’,

templateUrl: ‘./login.component.html’,

styleUrls: [‘./login.component.css’]

})

export class LoginComponent implements OnInit {


constructor() { }


loginSuccessHandler(event) {

//Handle Post login logic here.

const loggedInUserInfo = event.detail;

console.log(‘login Success’, loggedInUserInfo);


}

ngOnInit() {

}