我有webpack prod構建的問題,組件未加載。沒有錯誤。但其怪異的是開發建設工作正常..組件不加載角2 rc5
下面是代碼快照
貨運list.component.ts
@Component({
selector: 'freightList',
template: require('./freight-list.component.html')
})
貨運list.component.html使用文件 - 上傳這是沒有得到加載。
貨運list.component.html
<div [collapse]="hideFileUpload" class="card card-block card-header">
<div class="panel panel-default">
<div class="panel-body">
<file-upload> </file-upload>
</div>
</div>
</div>
<br>
<div class="panel panel-default">
<div class="panel-heading" style="height:800px; overflow-y: scroll;">
<div class="panel-body">
<table class="table table-bordered table-striped table-hover table-condensed">
<thead>
<tr>
<th>Section </th>
<th>Category</th>
<th>Product</th>
<th>Markup %</th>
<th>Effective Date</th>
</tr>
</thead>
............
............
............
下面是文件上傳指令
貨運fileupload.component.ts
import { Component } from '@angular/core';
import { FileUploader } from 'ng2-file-upload/ng2-file-upload';
const URL = 'app/freight/upload';
@Component({
selector: 'file-upload',
template: require('./freight-fileupload.component.html')
})
export class FreightFileUploadComponent {
...
}
應用程序代碼。 module.ts
@NgModule({
imports: [
BrowserModule,
FormsModule,
ReactiveFormsModule,
routing,
HttpModule
],
declarations: [
ErrorComponent,
FreightFileUploadComponent,
FILE_UPLOAD_DIRECTIVES,
CollapseDirective,
FreightListComponent,
FreightInputComponent,
FreightPipe,
TYPEAHEAD_DIRECTIVES,
AppComponent
],
exports:[FreightFileUploadComponent],
providers: [
FreightService,
ProductMasterSearchService
],
bootstrap: [ AppComponent ]
})
export class AppModule {
}
任何人都可以幫忙,這裏有什麼不對嗎?
如果它工作在開發環境得到了固定,機會是很高,這不是你的應用程序代碼的問題。這可能是您的構建問題。 – poke
任何提示什麼檢查生產構建? –
不知道,很大程度上取決於你如何建立你的東西。如果真的沒有錯誤(構建時間或運行時間),我會檢查構建輸出是否實際包含了較新的代碼(也許是舊代碼)。 – poke