小编Asa*_*hah的帖子

以角度2读取excel文件

我正在使用ng2-File-upload,我想读取excel文件及其所有行并获得总计数.有什么办法可以通过使用这个模块来实现它,以及如何通过纯JavaScript或打字稿来完成它.

javascript typescript ng2-file-upload angular

7
推荐指数
1
解决办法
1万
查看次数

可以在父级解析完成之前运行子级路由上的CanActivate守卫

我试图在导航到子级路由之前解析数据,因为我必须在儿童警卫队中使用该数据。问题是父级解析器,在解雇了儿童看守后解析数据。解析器需要很长时间才能解析数据

// app.module.ts
const appRoutes: Routes = [
  { path: 'login', component: LoginComponent },
  {
    path: '',
    component: SiteLayoutComponent,
    children: [
      { path: '', redirectTo: 'warehouse', pathMatch: 'full' },
      {
        path: 'warehouse',
        loadChildren: './warehouse/warehouse.module#WarehouseModule'
        // loadChildren: () => WarehouseModule
      }
    ],
    canActivate: [AuthGuard],
    resolve: {
      Site: SiteResolver // should be resolved before the guard is invoked.
    }
  },
  { path: '**', component: PageNotFoundComponent }
];

// warehouse.module.ts
const appRoutes: Routes = [

    { path: '', redirectTo: 'cash', pathMatch: 'full' }, …
Run Code Online (Sandbox Code Playgroud)

angular angular-router angular-route-guards angular-resolver

6
推荐指数
1
解决办法
1515
查看次数

具有相同父布局角度的功能模块路由

我想对不同的功能模块使用相同的布局(在app.module.ts 中定义),每个模块都有自己的路由。还有一个单独的登录/注册布局,没有侧面菜单、页眉和页脚。到目前为止,我试过这个:

//../app/app.component.html
<router-outlet></router-outlet> // here i want login and layout view.
Run Code Online (Sandbox Code Playgroud)

和一个布局组件:

//../app/layout.component.html
<header></header>
<side-menu></side-menu>
<router-outlet></router-outlet> // here i want layout views that would have side menu with them e.g. dashboard, inventory etc
<footer></footer>
Run Code Online (Sandbox Code Playgroud)

仪表板路由在 app.module.ts 中,但清单和其他模块有自己的模块和路由,如下所示:

//app.module.ts
const appRoutes: Routes = [
    { path: 'login', component: LoginComponent },
    {
        path: '',
        component: LayoutComponent,
        children: [
            { path: '', component: DashboardOne},
            { path: 'dashboardOne', component: DashboardOne},
            { path: 'dashboardTwo', component: DashboardTwo}
        ],
        canActivate: [AuthGuard]
    }
];    
@NgModule({ …
Run Code Online (Sandbox Code Playgroud)

typescript angular2-routing angular

5
推荐指数
1
解决办法
1198
查看次数

在 CanActivate 中获取目标路由 URL 防护延迟加载模块 Angular

I'm trying to get the target URL in canActivate guard but unable to do so. I've configured preloadingStrategy: PreloadAllModules in RouterModule.forRoot when i use ActivatedRoute its url property doesn't contain path. here's both of my module:

app.module.ts

const appRoutes: Routes = [
  { path: 'login', component: LoginComponent },
  {
    path: '',
    component: SiteLayoutComponent,
    children: [
      { path: '', redirectTo: 'dashboard', pathMatch: 'full' },
      {
        path: 'dashboard',
        loadChildren: './dashboard/dashboard.module#DashboardModule'
      },
      {
        path: 'user',
        loadChildren: './user/user.module#UserModule'
      }
    ]
  },
  { path: '**', …
Run Code Online (Sandbox Code Playgroud)

typescript angular angular-router

5
推荐指数
1
解决办法
3311
查看次数

带角度6的GRPC Web客户端

我已经使用grpc .net客户端和使用Java创建的grpc服务器,如何在带有Typescript的angular 6上实现grpc Web客户端?另外我该如何创建原型文件,它是为打字稿打字的?我正在关注此存储库,但无法生成原始文件。

typescript grpc angular grpc-web

4
推荐指数
2
解决办法
8690
查看次数