You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import{Component,OnInit}from"angular2/core";import{topmost}from"ui/frame";import{Page}from"ui/page";import{User}from"../../shared/user/user";import{UserService}from"../../shared/user/user.service";
@Component({providers: [UserService],selector: "login",templateUrl: "pages/login/login.html",styleUrls: ["pages/login/login-common.css","pages/login/login.css"]})exportclassLoginComponentimplementsOnInit{user: User;isLoggingIn=true;page: Page;constructor(private_userService: UserService){this.user=newUser();this.user.email="[email protected]";this.user.password="password";}ngOnInit(){this.page=<Page>topmost().currentPage;this.page.actionBarHidden=true;}login(){this._userService.login(this.user).subscribe(()=>alert("success!"),(error)=>alert("Unfortunately we could not find your account."));}}
ng5 (login.component.ts) - use the router (show app.component.ts)
import{Component,OnInit}from"angular2/core";import{topmost}from"ui/frame";import{Page}from"ui/page";import{Router}from"angular2/router";import{User}from"../../shared/user/user";import{UserService}from"../../shared/user/user.service";
@Component({providers: [UserService],selector: "login",templateUrl: "pages/login/login.html",styleUrls: ["pages/login/login-common.css","pages/login/login.css"]})exportclassLoginComponentimplementsOnInit{user: User;isLoggingIn=true;page: Page;constructor(private_userService: UserService,private_router: Router){this.user=newUser();this.user.email="[email protected]";this.user.password="password";}ngOnInit(){this.page=<Page>topmost().currentPage;this.page.actionBarHidden=true;}login(){this._userService.login(this.user).subscribe(()=>this._router.navigate(["List"]),(error)=>alert("Unfortunately we could not find your account."));}}
firstTime=true;login(){if(this.firstTime){explosion.explode(this.page.getViewById("logo"));this.firstTime=false;}else{explosion.explode(this.page.getViewById("container"));setTimeout(()=>{explosion.explode(this.page.getViewById("background"));},5000);}/*this._userService.login(this.user) .subscribe( () => this._router.navigate(["List"]), (error) => alert("Unfortunately we could not find your account.") );*/}