在函数调用时切换到另一个 angular 组件
Switch to another angular component on function calling
我正在尝试通过函数调用从另一个组件调用一个组件。
在我的项目中,我一共有两个组件。
pages/component1/
pages/tables/maintables
如上所述我一共定义了两个组件Angular 7.
现在在 component1
组件中,我有一个函数是从 maintables
组件中的另一个函数调用的。
下面是我如何在函数中调用组件的代码。
this.router.navigateByUrl('/component1');
但上面的行不起作用 properly.it 没有重定向到 component1
组件。
任何人都可以帮助我如何从不同的组件调用另一个 angular 组件?
提前致谢!
现在所有问题都解决了,我在 app.routing.module + 另一个模块中导入了组件,这是我所有组件的父模块。
所以它解决了我的问题。
非常感谢大家的帮助。
我正在尝试通过函数调用从另一个组件调用一个组件。
在我的项目中,我一共有两个组件。
pages/component1/
pages/tables/maintables
如上所述我一共定义了两个组件Angular 7.
现在在 component1
组件中,我有一个函数是从 maintables
组件中的另一个函数调用的。
下面是我如何在函数中调用组件的代码。
this.router.navigateByUrl('/component1');
但上面的行不起作用 properly.it 没有重定向到 component1
组件。
任何人都可以帮助我如何从不同的组件调用另一个 angular 组件?
提前致谢!
现在所有问题都解决了,我在 app.routing.module + 另一个模块中导入了组件,这是我所有组件的父模块。
所以它解决了我的问题。
非常感谢大家的帮助。