2016-09-22 106 views
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上部署之後雖然沒有內容呈現。其他一切工作都很好。控制檯中沒有單個錯誤或警告。我不知道它可能是什麼...

+0

我相信,在生產你有enabledProdMode隱藏了所有的錯誤。你能把它關掉嗎?另外,我不確定您是否可以使用@作爲您的輸入 –

+0

@LeoCaseiro'[@elementState]'是[觸發](https://angular.io/docs/ts/latest/api/core/ index/trigger-function.html)我相信 – cvsguimaraes

+0

這是真的,我可以看到它在這裏工作https://bergben.github.io/ng2-scrollimate/。我沒有意識到這一點。謝謝@snolflake –

回答