我有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