ng2-login-form v1.0.7
ng2-login-form
Login form for Angular 2. Using:
- Angular2 (2.0.0-beta.0)
- SystemJs
- Support MaterializeCss or Bootstrap
Getting started
Install via npm::
npm install ng2-login-form --save
Configure SystemJs. In this case the main folder is app::
Add to the file boot.ts the class LoginForm::
import {bootstrap} from 'angular2/platform/browser'; import {LoginForm} from 'ng2-login-form/src/login';
bootstrap(LoginForm);
Add the tag ::
//With type email
//With type username
The attributes are not obligatory have default values. For example::
Value default of 'type_username_or_email': In this case value default is the type email.
Value default of 'username': 'Username'.
Value default of 'email': 'Email'.
Value default of 'password': 'Password'.
Value default of 'frameworkCss': 'bootstrap'.
Value default of 'send': 'Send'.
Value default of 'url': 'send'.
This last attribute (url) is the url that receives POST parameters to the backend.
This component using API Fetch, if is necessary add polyfill https://github.com/github/fetch. Not is obligatory.
For redirect the component check if data.status is 200 and data.ok is true. If this condition is correct redirect to url data.url defined. The object data is the response.
Example
Check the file index_
To the run example of the folder example::
npm install
npm start
.. _index: https://github.com/mapeveri/ng2-login-form/blob/master/example/index.html