typescript - GET http://localhost:4200/api/user/ 404 (Not Found) angular 2 -


i have error when try login app have problems 404(not found) included... put lines of code , image of error..... please me fix issue .

@injectable() export class authguard implements canactivatechild {   loggedinuser: string;    constructor( private localstorage: localstorageservice, private router: router ) {     this.loggedinuser = localstorage.get('discogs-user') string;   }    canactivatechild(route: activatedroutesnapshot, state: routerstatesnapshot): boolean {     if (this.loggedinuser) {       return true;     }      this.router.navigate(['/login']);   } } 

this login.component.ts subscribe

import { component } '@angular/core'; import { store } '@ngrx/store'; import { router } '@angular/router';  import { observable } 'rxjs/observable';  import { mdlsnackbarservice } 'angular2-mdl';  import * fromroot '../../reducers'; import * user '../../actions/user';  import { discogsuser, userlogin } '../../models';  @component({   selector: 'app-login',   templateurl: './login.component.html' }) export class logincomponent {   user$: observable<discogsuser>;    login(login: userlogin) {     if (!login.username) {       this.store.dispatch(new user.loginfailedaction('you must enter username'));       return;     }      this.store.dispatch(new user.loginaction(login));     this.router.navigate(['/']);   }    private _showerror(message: string) {     this.mdlsnackbarservice.showsnackbar({       message: message,       action: {         handler: () => { },         text: 'ok'       }     });   }    constructor(private store: store<fromroot.state>, private router: router, private mdlsnackbarservice: mdlsnackbarservice) {       this.user$ = store.select(fromroot.getuser);        store.select(fromroot.getloginfailed)         .subscribe(error => {           if (error) {             this._showerror(error);           }         });      } } 

this image of error

error


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -