带有选项--prod和--aot的Angular CLI构建错误

时间:2017-12-29 10:28:48

标签: angular command-line-interface angular-cli serve

感谢您阅读我的问题。 现在,我在Angular CLI中构建应用程序。 这是我的package.json:

{
"@angular/animations": "^5.0.0",
"@angular/cdk": "^5.0.0",
"@angular/common": "^5.0.0",
"@angular/compiler": "^5.0.0",
"@angular/compiler-cli": "^5.0.0",
"@angular/core": "^5.0.0",
"@angular/flex-layout": "*",
"@angular/forms": "^5.0.0",
"@angular/http": "^5.0.0",
"@angular/material": "^5.0.0",
"@angular/platform-browser": "^5.0.0",
"@angular/platform-browser-dynamic": "^5.0.0",
"@angular/platform-server": "^4.4.4",
"@angular/router": "^5.0.0",
"angular-in-memory-web-api": "~0.3.0",
"angular2-json-schema-form": "*",
"angular2-toaster": "*",
"core-js": "^2.4.1",
"ng2-responsive": "*",
"rxjs": "^5.5.2",
"socket.io-client": "^1.3.0",
"systemjs": "0.19.40",
"traceur": "*",
"zone.js": "^0.8.14"

}

在我的应用程序中,我有一些选择标记,如:

<div class="tab-pane fade" id="v-pills-auto" role="tabpanel" aria-labelledby="v-pills-auto-tab">
      <div class="row justify-content-center">
        <div class="mb-2 schema-form-div list-group-item form-group col-md-12" *ngFor="let choice of autoRestartScheduleField; let idx = index;">
          <div class="row">
            <label for="cluster" class="m-auto col-md-1">Cluster </label>
            <select class="p-0 m-auto col-md-4 form-control" name="cluster" id="cluster" [(ngModel)]="autoRestartScheduleField[idx].cluster" (change)="onSelectClusterChange(idx)">
              <option *ngFor="let cls of listClusterCanChoice" value="{{cls.cluster}}" [disabled]="cls.hide">{{cls.cluster}}</option>
            </select>
            <label for="timer" class="m-auto col-md-1">Timer </label>
            <input class="m-auto col-md-1 form-control" name="timer" id="timer" [(ngModel)]="autoRestartScheduleField[idx].timer" type="number">
            <label for="type" class="m-auto col-md-1">Type </label>
            <select class="p-0 m-auto col-md-2 form-control" name="type" id="type" [(ngModel)]="autoRestartScheduleField[idx].type">
              <option class="mat-select" value="hour">hour</option>
              <option class="mat-select" value="day">day</option>
              <option class="mat-select" value="week">week</option>
            </select>
            <button class="mr-3 col-md-1 btn btn-warning" (click)="removeField(idx)">Delete</button>
          </div>
        </div>
        <div class="row">
          <button class="btn btn-secondary" (click)="addNewField()">New</button>
          <button class="ml-3 btn btn-primary" (click)="autoRestartOnSubmit()">Save!</button>
        </div>

      </div>
  </div>

当我选择一些值时,我使用twoway绑定和(更改)处理程序事件。 所以,当我用&#34; ng server&#34;运行时,我的应用程序就像这样(这是我想要的结果): Run my application with "ng serve" version

但是,当我用cammand&#34; ng build --prod --aot&#34;构建应用程序时,我在快递服务器上运行它,我收到结果(我不知道为什么会发生这种情况) ???): Run my application with "ng build --prod --aot" version

然而,我再次使用命令&#34; ng build&#34;没有选择并在我的快速服务器上运行它,我收到的结果就像我运行&#34; ng serve&#34;。 Run my application with "ng build" without opts

我不知道为什么会这样。我在运行时打破了一些东西&#34; ng build --prod --oat&#34;但我没有收到任何警告或错误。

再次感谢新年快乐!

0 个答案:

没有答案