Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我一直在寻找这个问题的答案,但文档非常有限。我希望能够在不使用 # 符号的情况下为我的应用程序键入一个 url。谁能提供一个例子?谢谢你。
要使用 启用路由#,请将其添加到 Angular 应用级提供程序
#
Provider<LocationStrategy>( LocationStrategy, useClass: HashLocationStrategy)
无论如何,没有#是默认值。 服务器需要支持 HTML5 PushState 才能工作。
另请参阅Web 应用程序中的 PathLocationStrategy 与 HashLocationStrategy