当独立应用程序中的di routerstate触发nullinjectionorError

问题描述 投票:0回答:1
我正在全新的Angular应用中遇到错误。 我刚刚将此应用程序生成了一个Angular App(NG New AstaloNeapp)。在

NullInjectorError

构造函数中,我添加了
standalone
参数:
AppComponent's
足以打破应用程序。它生成下面显示的运行时错误。我在论坛上看到了一个类似的问题,但没有任何令人满意的答案或解决方案。我想念什么吗? (该应用具有
RouterState

类,包括
constructor(private routerState : RouterState) {

  }

app.config.ts
	

您可以使用
provideRouter(routes)
的thert there
angular dependency-injection angular-routing angular-standalone-components
1个回答
0
投票

GETRouterState源代码

RouterState

如果您想要每个子路线的状态,则应访问routerState

Router
di令牌。


最新问题
© www.soinside.com 2019 - 2025. All rights reserved.