使用Angle Universal的angular 6 meta标签在延迟加载应用上不起作用

时间:2018-11-24 13:08:47

标签: angular angular-universal

blog.module.ts

const routes: Routes = [
  { path: '',    component: BlogHomeComponent,
    children: [
      {path: '', component:  BlogPostsComponent}
    ] 
  }
];

BlogPostComponent.ts

constructor(
    private meta: Meta,
    private title: Title){}

ngOnInit() {    
    this.meta.addTags([
      {name: 'description', content: 'dummy description'},
      {name: 'author', content: 'dummy name'},
      {name: 'keywords', content: 'dummy keywords'}
    ]); 
}

此代码在正常组件中正常工作,但是如果我将此代码保留在带有子级的延迟加载组件中,那么它将无法正常工作

我需要在视图源中显示元标记。

enter image description here enter image description here

0 个答案:

没有答案