组件未加载角度2 rc5

时间:2016-08-31 07:06:09

标签: angular typescript

我遇到webpack prod构建问题,组件没有加载。而且没有错误。但奇怪的是dev开发工作正常......

以下是代码快照

货运list.component.ts

@Component({
    selector: 'freightList',
    template: require('./freight-list.component.html')
})

Freight-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 {
...
}

app.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 {

}

有人可以帮忙,这里有什么问题吗?

2 个答案:

答案 0 :(得分:0)

我认为你的@component装饰器应如下所示:

yo jhipster:entity <entityName>

注意templateUrl而不是模板 和&#39; some_folder&#39;而是&#39;。&#39;

答案 1 :(得分:0)

这是角度rc5中的错误,当我升级到rc6

时得到修复