动态页面的划分问题,甚至没有尝试访问组件

问题描述 投票:0回答:1

{ path: 'news/:slug', component: NewsItemComponent },

使用此导入将其连接到组件

import { NewsItemComponent } from './news-item/news-item.component';

我在Visual Studio中为我的IDE介绍,所以它确实告诉我这条路是否不正确。

到目前为止,一切都很好,但是,如果我导航到

/新闻/my-news-intem-slug

,则URL有200个响应,但是在我的Chrome Developer工具网络选项卡中,没有尝试调用API端点,并且没有任何控制台。
这不是CORS的事情,我已经测试了Angular之外的API呼叫,但是由于没有对API进行呼叫,这是无关紧要的。
从所有这些我都可以假设“ NewsItemComponent”没有被击中。

据我所知,我正在根据我使用的Angular版本正确设置路线!

	

您启用了SSR,因此在服务器上进行了API调用,并且内容已列为PRERENDER。

内容存储在

angular transfer cache.中。

如果您想改变这种行为(不是一件坏事)。 Provideclienthydration

具有nohttptransfrcache

angular angular-routing
1个回答
0
投票
import { provideClientHydration } from '@angular/platform-browser'; import { bootstrapApplication } from '@angular/platform-browser'; import { AppComponent } from './app/app.component'; bootstrapApplication(AppComponent, { providers: [ provideClientHydration(withNoHttpTransferCache()), ], });

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