Skip to content

Frannca/ngx-login

Repository files navigation

ngx-login

Login library for Angular 4+

npm Travis PRs Welcome Commitizen friendly semantic-release

This library is focused on Angular authentication and is part of Frannca's Solutions to save time on projects development.

Table of Contents

Installation

You need npm to install the package. If you do not have npm installed, follow this instructions.

npm

npm install @frannca/ngx-login --save

Usage

The library is packed with everything you need to get login works.

Import the module

The first thing you have to do, is to import the NgxLoginModule in the AppModule:

NgxLoginModule.forRoot({
  apiUrl: 'API_URL',
})

Insert the component

Now you just need to insert the component where you want the login to be displayed:

<app-ngx-login></app-ngx-login>

Configuration

The ngx-login comes with nice configuration options:

Option Default Value Description
color 'frannca' Login box color
fieldOne 'email' Name of the first field used for the API
fieldTwo 'password' Name of the second field used for the API
logo NGX_LOGIN_LOGO Login logo
messageError 'Error!' Toastr error title
messageSuccess 'Success!' Toastr success title
prefix 'ngx_login_' Prefix used by the localStorage
redirect '/' Angular internal redirect
redirectExternal null Angular external redirect

NGX_LOGIN_LOGO: this is a constant with the ngx-login base64 logo.

Requirements

  • Angular 4 or higher
  • Toastr 6.0.0

Contributing

We would love to have your contributions. Please read the CONTRIBUTING.md file for more information.

Copyright and license

Code copyright 2018 Frannca. Code released under the MIT license.