Angular 2/5 User Registration and Login Example & Tutorial
To see a demo and further details go to http://jasonwatmore.com/post/2016/09/29/angular-2-user-registration-and-login-example-tutorial
Angular 2/5 User Registration and Login Example
Home Page: http://jasonwatmore.com/post/2016/09/29/angular-2-user-registration-and-login-example-tutorial
License: MIT License
Angular 2/5 User Registration and Login Example & Tutorial
To see a demo and further details go to http://jasonwatmore.com/post/2016/09/29/angular-2-user-registration-and-login-example-tutorial
With current version of Angular (5.0.1), the @angular/http NPM package is deprecated.
Reference for migration : http://blog.ninja-squad.com/2017/07/17/http-client-module/
this.authService.authenticateUser(user).subscribe(data => {
if (data.success){
this.authService.storeUserData(data.token, data.user);
this.flashMessages.show('You are now logged in',{ cssClass: 'alert-success', timeout:5000});
this.router.navigate(['/dashboard']);
} else {
this.flashMessages.show(data.msg, { cssClass: 'alert-danger', timeout:5000});
this.router.navigate(['/login']);
}
});
i later changed it to
if (data['success']){.............
but while login it is going to dashboard even if the password or username is wrong...
nodejs 10.5.0
angular2
Hi Alert services is not working , I tried to dig out but unable to fix it.. I am new in angular2 , so please look in it.
import { Component, OnInit } from '@angular/core';
import { AlertService } from './../services/index';
@component({
moduleId: module.id,
selector: 'alert',
templateUrl: 'alert.component.html',
providers: [AlertService],
})
export class AlertComponent implements OnInit {
private message: any;
constructor(private _alertService: AlertService) {}
ngOnInit() {
this._alertService.getMessage().subscribe(message => {
alert(message); // on error this is not executing
this.message = message;
});
}
}
Node -v = v6.10.2
NPM -v = 5.0.3
$ npm install
npm WARN deprecated [email protected]: Use uuid module instead
> [email protected] install /Users/peter/angular2-registration-login-example/node_modules/fsevents
> node install
[fsevents] Success: "/Users/peter/angular2-registration-login-example/node_modules/fsevents/lib/binding/Release/node-v48-darwin-x64/fse.node" already installed
Pass --update-binary to reinstall or --build-from-source to recompile
npm notice created a lockfile as package-lock.json. You should commit this file.
added 458 packages in 21.754s
> $ npm start
> [email protected] start /Users/peter/angular2-registration-login-example
> tsc && concurrently "npm run tsc:w" "npm run lite"
node_modules/rxjs/Subject.d.ts(16,22): error TS2415: Class 'Subject<T>' incorrectly extends base class 'Observable<T>'.
Types of property 'lift' are incompatible.
Type '<R>(operator: Operator<T, R>) => Observable<T>' is not assignable to type '<R>(operator: Operator<T, R>) => Observable<R>'.
Type 'Observable<T>' is not assignable to type 'Observable<R>'.
Type 'T' is not assignable to type 'R'.
node_modules/rxjs/observable/dom/WebSocketSubject.d.ts(24,22): error TS2415: Class 'WebSocketSubject<T>' incorrectly extends base class 'AnonymousSubject<T>'.
Types of property 'lift' are incompatible.
Type '<R>(operator: Operator<T, R>) => WebSocketSubject<R>' is not assignable to type '<R>(operator: Operator<T, R>) => Observable<T>'.
Type 'WebSocketSubject<R>' is not assignable to type 'Observable<T>'.
Types of property 'operator' are incompatible.
Type 'Operator<any, R>' is not assignable to type 'Operator<any, T>'.
Type 'R' is not assignable to type 'T'.
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] start: `tsc && concurrently "npm run tsc:w" "npm run lite" `
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Alert service not working properly can't find the problem.
0 info it worked if it ends with ok
1 verbose cli [ 'C:\Program Files\nodejs\node.exe',
1 verbose cli 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js',
1 verbose cli 'start' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle [email protected]prestart: [email protected]prestart: no script for prestart, continuing
6 silly lifecycle [email protected]
7 info lifecycle [email protected]start: [email protected]start: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]
9 verbose lifecycle [email protected]start: PATH: C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin;C:\Users\mdonner\Documents\esportify\node_modules.bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\SysWOW64\Empirum;C:\Program Files\PuTTY;C:\Program Files (x86)\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn;C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn;C:\Program Files (x86)\Microsoft SQL Server\130\DTS\Binn;C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn\ManagementStudio;C:\Program Files (x86)\Enterprise Vault\EVClient;C:\Program Files\nodejs;C:\Users\mdonner\AppData\Local\Microsoft\WindowsApps;C:\Users\mdonner\AppData\Local\atom\bin;C:\Users\mdonner\AppData\Roaming\npmstart: CWD: C:\Users\mdonner\Documents\esportify
10 verbose lifecycle [email protected]
11 silly lifecycle [email protected]start: Args: [ '/d /s /c',start: Returned: code: 2 signal: null
11 silly lifecycle 'tsc && concurrently "npm run tsc:w" "npm run lite" ' ]
12 silly lifecycle [email protected]
13 info lifecycle [email protected]~start: Failed to exec start script
14 verbose stack Error: [email protected] start: tsc && concurrently "npm run tsc:w" "npm run lite"
14 verbose stack Exit status 2
14 verbose stack at EventEmitter. (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:255:16)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at EventEmitter.emit (events.js:191:7)
14 verbose stack at ChildProcess. (C:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:40:14)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at ChildProcess.emit (events.js:191:7)
14 verbose stack at maybeClose (internal/child_process.js:886:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
15 verbose pkgid [email protected]
16 verbose cwd C:\Users\mdonner\Documents\esportify
17 error Windows_NT 10.0.14393
18 error argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "start"
19 error node v6.10.3
20 error npm v3.10.10
21 error code ELIFECYCLE
22 error [email protected] start: tsc && concurrently "npm run tsc:w" "npm run lite"
22 error Exit status 2
23 error Failed at the [email protected] start script 'tsc && concurrently "npm run tsc:w" "npm run lite" '.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the angular2-registration-login-example package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error tsc && concurrently "npm run tsc:w" "npm run lite"
23 error You can get information on how to open an issue for this project with:
23 error npm bugs angular2-registration-login-example
23 error Or if that isn't available, you can get their info via:
23 error npm owner ls angular2-registration-login-example
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]
Versions of @angular/compiler-cli and typescript could not be determined.
The most common reason for this is a broken npm install.
Please make sure your package.json contains both @angular/compiler-cli and typescript in
devDependencies, then delete node_modules and package-lock.json (if you have one) and
run npm install again.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.