EXCEPTION由以下原因引起:__ webpack_require __。i(...)不是函数

时间:2017-03-29 12:04:21

标签: javascript angular typescript webpack angular-cli

我正在开发角度2网络应用程序,它在我通过angular-cli verion升级到1.0.0以前它是1.0.0-rc.4时中断了

你能帮助我弄清楚如何阅读错误信息并找出造成问题的实际代码。

我的new-order.component.ts



import { Component, OnInit, ViewChild } from '@angular/core';
import { Validators, FormArray, FormGroup, FormBuilder } from '@angular/forms';
import { Router } from '@angular/router';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/observable/forkJoin';
import * as moment from 'moment'

import { User, Order, Company, Sending } from 'cargosteps-api';
import { randomCharacters } from 'cargosteps-api';
import { TransformService, UserService, CompanyService, OrderService } from 'cargosteps-api';
import { SlimLoadingBarService } from 'ng2-slim-loading-bar';

import { hideCurtin, openCurtain, formatSending } from '../../../utils';

@Component({
  selector: 'cargosteps-new-order',
  templateUrl: './new-order.component.html',
  styleUrls: ['./new-order.component.css']
})
export class NewOrderComponent implements OnInit {
  public orderForm: FormGroup;
  driverList:Array<User> = [];
  contactList: Array<Company> = [];
  isLoading = true;
  order: Order;

  constructor(
    public userService: UserService,
    public trans: TransformService,
    public slim: SlimLoadingBarService,
    public companyService: CompanyService,
    public _fb: FormBuilder,
    public orderService: OrderService,
    private router: Router
    ) {
      this.order = new Order();
    }

  ngOnInit() {
    openCurtain();
    this.orderForm = this._fb.group({
      tracking_id : '',
			notes : ''
    });

    Observable.forkJoin([this.userService.getUsers(), this.companyService.getAll()]).subscribe(results => {
        this.driverList = results[0];
        this.isLoading = false;
        this.contactList = <any>results[1];
        this.slim.complete();
    }, err => {
      console.log("Error occured ", err);
    });
  }

  cancelSaving() {
    hideCurtin();
    this.router.navigate(['/be']);
  }

  saveOrder(sending: any) {
    var order = this.orderForm.value;
    order.sending_set = [];
    var copySending = formatSending(sending);
    delete copySending.forwardedsending;
    order.sending_set.push(copySending);
    this.orderService.createOrder(order).subscribe(newOrder => {
      hideCurtin();
      this.router.navigate(['/be/orders/', newOrder.id]);
    }, err => {
      window.alert("Error Occured " + err);
    });
  }

  removeCustomerEmail(email) {
    console.log("Removing Email");
  }

  initSending() {
    return this._fb.group({
      tmp_id : randomCharacters(8),
      customer_emails : this._fb.array([
        this.initEmail()
      ]),
      sort_id  : 1,
      pickup_date : Date.now,
      delivery_date : Date.now,
      driver_id : 0,
      notes : '',
      package_set: this._fb.array([
        this.initPackage(),
      ]),
      pickup_address : this._fb.group({
        latitude : null,
        longitude :  null,
        contact : '' ,
        address : '' ,
        zoom : false ,
        latLong : null ,
        sortID : 0
      }),
      delivery_address : this._fb.group({
        latitude : null,
        longitude :  null,
        contact : '' ,
        address : '' ,
        zoom : false ,
        latLong : null ,
        sortID : 0
      })
    });
  }

  initEmail() {
    return this._fb.group({
      email: ['']
    });
  }


  initPackage() {
    return this._fb.group({
      count: [1, Validators.required],
      weight: [0, Validators.required],
      reference_number: ['', Validators.required],
      dim_depth: [0, Validators.required],
      dim_width: [0, Validators.required],
      dim_height: [0, Validators.required],
      remarks: ['']
    });
  }
}
&#13;
&#13;
&#13;

&#13;
&#13;
<div class="panel panel-default dashboardPanel" style="z-index: 1500; position: relative; overflow: hidden" *ngIf="!isLoading">
  <cargosteps-sending-form
		[driverList]="driverList"
		[contactList]="contactList"
		(saveOrder)="saveOrder($event)"
		(cancelSaving)="cancelSaving()">
	</cargosteps-sending-form>
</div>
&#13;
&#13;
&#13;

enter image description here

0 个答案:

没有答案
相关问题