我尝试使用webpack进行模块开发:我使用npm link命令在我的示例应用程序中获取自定义模块。
但我有这个错误: Error in console
如果我将我的组件(.ts,.html)放在应用程序源中,没有错误,它就可以了。 那么错误在哪里?
编辑:我的所有组件都出现此错误
spinner.component.ts:
import { Component, Input, OnDestroy } from '@angular/core';
@Component({
selector: 'an-spinner',
styles: [
`
... DELETE to limit the number of line codes
`,
],
template: require( './spinner.component.html'),
})
export class SpinnerComponent implements OnDestroy {
private currentTimeout: number = undefined;
private isDelayedRunning: boolean = false;
@Input()
public delay: number = 300;
@Input()
public set visible(value) {
if (! value) {
this.cancelTimeout();
this.isDelayedRunning = false;
} else if (! this.currentTimeout) {
this.currentTimeout = setTimeout(() => {
this.isDelayedRunning = value;
this.cancelTimeout(); }, this.delay);
}
}
private cancelTimeout(): void {
clearTimeout(this.currentTimeout);
this.currentTimeout = undefined;
}
ngOnDestroy(): any {
this.cancelTimeout();
}
}
spinner.component.html:
<div [hidden]="!isDelayedRunning" class="containerspin">
<div class="spinner">
<div class="sk-fading-circle">
<div class="sk-circle1 sk-circle"></div>
<div class="sk-circle2 sk-circle"></div>
<div class="sk-circle3 sk-circle"></div>
<div class="sk-circle4 sk-circle"></div>
<div class="sk-circle5 sk-circle"></div>
<div class="sk-circle6 sk-circle"></div>
<div class="sk-circle7 sk-circle"></div>
<div class="sk-circle8 sk-circle"></div>
<div class="sk-circle9 sk-circle"></div>
<div class="sk-circle10 sk-circle"></div>
<div class="sk-circle11 sk-circle"></div>
<div class="sk-circle12 sk-circle"></div>
</div>
</div>