Angular ngoninit在路由时每次都被调用
我有一个组件详细信息,其中其他儿童组件的路线在其中。发生的事情是,当我路由到任何其他子女组件时,详细信息就会被调用。
例如 - example.com/details/123123123/profile是我当前的路线,
我正在导航到example.com/details/12312331/pastappoartment
,那么详细信息的ngoninit就被调用了。这打电话给我不想要的所有API。
I have one component Details where the routes for other child components is there. What is happening is that when I route to any other child component then the onint of the Details is getting called.
For Example- example.com/details/123123123/profile is my current route
I am navigating to example.com/details/12312331/pastappointment
then the NgOnInit of Details is getting called. Which is calling all the apis that I don't want.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须
在详细信息组件中使用。
You have to use
inside your Details component.