【问题标题】:How to make Ladda work with angular2 application如何使 Ladda 与 angular2 应用程序一起工作
【发布时间】:2018-01-11 06:25:26
【问题描述】:

我正在尝试将 ladda 与我的 angular2 应用程序集成。我基本上是在尝试导入库并使用 Ladda 变量。 Angular 似乎没有找到那个变量。有什么建议么。

【问题讨论】:

    标签: angular spinner


    【解决方案1】:
    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
    

    【讨论】:

      【解决方案2】:
      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();
          }
      }
      

      【讨论】:

        【解决方案3】:

        您可以使用实现 angular2-ladda 的 Angular 4+ Ladda 模块。

        Check out Ladda's demo

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2016-07-22
          • 1970-01-01
          • 1970-01-01
          • 2022-01-05
          • 2019-11-20
          相关资源
          最近更新 更多