小编NIT*_*SH 的帖子

当我使用 canActivate Guard 时,它会导致角度 4 出现空白页面?

我正在尝试使用 Angular 4 实现登录功能,但是当我使用 canActivate Guard 时,它会导致我进入空白页面,请帮助我

这是我的登录服务

 isAuthenticated(){
   return localStorage.getItem('token') != null ;
   }
Run Code Online (Sandbox Code Playgroud)

这是可以激活守卫的

  canActivate(route : ActivatedRouteSnapshot , state : RouterStateSnapshot){

    return this.loginservice.isAuthenticated();
  }
Run Code Online (Sandbox Code Playgroud)

这是路由器模块

 const appRoutes: Routes = [
  {path : '' , redirectTo:'/login', pathMatch :'full' },
  {path : 'login' , component : LoginComponent },
  {path : 'home' , component : HomeComponent, canActivate : [AuthGuard] ,children :[

          {path : 'adduser' , component : AdduserComponent },
          ]  
Run Code Online (Sandbox Code Playgroud)

typescript angular

4
推荐指数
1
解决办法
2979
查看次数

使用 ionic 3 在 SQLite 上批量插入

我想在 ionic 3 中进行批量插入我有这个代码它可以工作但它真的很慢

 insertQuotation(value){

    for(var i=0; i<=value.length; i++){
    let data=[value[i].quotation_id,value[i].customer_name,value[i].product_name,value[i].price,value[i].services,value[i].response_time,value[i].created_time];

    this.database.executeSql("insert into care_plan_quotation_history(care_plan_quotation_id,customer_name,product,price,services,response_time,created_time) values(?,?,?,?,?,?,?)",data)
    .then(data=>{
      return data;
    },err=>{
      alert("error");
    })
    }
  }
Run Code Online (Sandbox Code Playgroud)

请在这件事上给予我帮助

sqlite ionic-framework ionic3 angular

2
推荐指数
1
解决办法
1413
查看次数

标签 统计

angular ×2

ionic-framework ×1

ionic3 ×1

sqlite ×1

typescript ×1