我最近将我的项目升级为angular-cli @ webpack in angular RC5。
我使用以下方法安装了lodash:
npm install lodash --save
然后在我的ts文件中,我将其用作:
import { Component, OnInit, Type, Input, OnChanges, ViewContainerRef, ViewChild } from '@angular/core';
declare var _:any;
@Component({
selector: 'property-editor',
templateUrl: 'property-editor.component.html',
styleUrls: ['property-editor.component.css']
})
export class PropertyEditorComponent implements OnInit, OnChanges {
@Input('component-name') componentName: string;
@Input('component-model') componentModel: RapidColumn;
counter: number = 0;
constructor() { }
ngOnInit() {
console.log(this.isArray(this.componentModel));
}
//============================Data Type Operations==============================//
isArray(data:any):boolean{
return _.isArray(data);
}
isObject(data:any){
return _.isObject(data);
}
isString(data:any):boolean{
return _.isString(data);
}
}
但每当我尝试在我的.ts文件中导入它时,它会给出错误。
任何输入?