0
不知何故,组件在Heroku上的部署版本中不会呈现,本地它可以正常工作。没有错误,没有任何 - 它只是没有得到渲染。Angular 2组件不在渲染版本上渲染
因此,我在顶部看到了一个导航栏的模板,如下所示: (请注意,我使用的是Angular Meteor 2.0,因此使用一些特殊的角度编译器导入模板非常合适。 。)
import { Component } from "@angular/core";
import template from "./about-navigation.html";
@Component({
selector: "about-navigation",
template,
})
export class AboutNavigation {
}
它在app.module.ts delcarations:
...
import { AboutNavigation } from "./templates/about-navigation/about-navigation";
@NgModule({
...
declarations: [ AppComponent,
About,
AboutNavigation,
],
bootstrap: [ AppComponent ]
})
export class AppModule { }
所以那么这里就是我的实际成分:
@Component({
selector: "about",
template,
})
export class About {
constructor(private router: Router) {
});
}
}
和它的模板:
<about-navigation></about-navigation>
<div class="container about-content page-transition" [@elementState]="pageTransition" >
<router-outlet></router-outlet>
</div>
此选择<about-navigation></about-navigation>
是在Heroku上部署之后虽然没有内容呈现。其他一切工作都很好。控制台中没有单个错误或警告。我不知道它可能是什么...
我相信,在生产你有enabledProdMode隐藏了所有的错误。你能把它关掉吗?另外,我不确定您是否可以使用@作为您的输入 –
@LeoCaseiro'[@elementState]'是[触发](https://angular.io/docs/ts/latest/api/core/ index/trigger-function.html)我相信 – cvsguimaraes
这是真的,我可以看到它在这里工作https://bergben.github.io/ng2-scrollimate/。我没有意识到这一点。谢谢@snolflake –