【发布时间】:2018-01-11 06:25:26
【问题描述】:
我正在尝试将 ladda 与我的 angular2 应用程序集成。我基本上是在尝试导入库并使用 Ladda 变量。 Angular 似乎没有找到那个变量。有什么建议么。
【问题讨论】:
我正在尝试将 ladda 与我的 angular2 应用程序集成。我基本上是在尝试导入库并使用 Ladda 变量。 Angular 似乎没有找到那个变量。有什么建议么。
【问题讨论】:
declare const Ladda: any;
export class someComponent implements AfterViewInit{
@ViewChild('scbutton') scbutton: ElementRef;
l:any;
ngAfterViewInit() {
this.l = Ladda.create(this.scbutton.nativeElement);
}
}
// u can use this.l.start() and this.l.stop() in ur submit logic
【讨论】:
import Ladda from 'ladda';
export class someComponent implements AfterViewInit {
@ViewChild('yourButton') yourButton: ElementRef;
l: any;
ngAfterViewInit() {
this.l = Ladda.create(this.scbutton.nativeElement);
this.l.start();
}
}
【讨论】:
您可以使用实现 angular2-ladda 的 Angular 4+ Ladda 模块。
【讨论】: