Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular 在所有模块组件上运行函数_Angular_Typescript - Fatal编程技术网

Angular 在所有模块组件上运行函数

Angular 在所有模块组件上运行函数,angular,typescript,Angular,Typescript,我有以下配置: -channel.module.ts -channel.component.ts -channel.component.html - ... -组件1 -component1.component.ts -组件2 -组件2.component.ts 所有子组件都从channel.component.html继承视图。 所以,我想检查当用户想要访问所有通道模块子组件并将其重定向到特定页面时,他是否有一些特权 我想在channel.component.ts的ngOnInit中实现验证,

我有以下配置:

-channel.module.ts
-channel.component.ts
-channel.component.html
- ...
-组件1
-component1.component.ts
-组件2
-组件2.component.ts

所有子组件都从channel.component.html继承视图。 所以,我想检查当用户想要访问所有通道模块子组件并将其重定向到特定页面时,他是否有一些特权

我想在channel.component.ts的ngOnInit中实现验证,但这只是第一次运行

你知道这个成就吗


考虑到

可能需要在路线上使用警卫components@AshishRanjan谢谢你,这很有效!可能需要在路线上使用警卫components@AshishRanjan谢谢你,这很有效!