小编CE0*_*CE0的帖子

在角度 5 中单击时创建按钮微调器

我试图在单击按钮时创建一个微调器,但它似乎没有运行,这就是我在 component.html 中所做的

<button type="submit" class="btn  btn-accent btn-block btn-flat b-r-10" style="background: #FF473A;">
  Sign In
  <i class="fa fa-spinner fa-spin" *ngIf="loading"></i>
</button>
Run Code Online (Sandbox Code Playgroud)

并在 component.ts 中

export class LoginComponent implements onInit {
  private loading: boolean;

  //form ngSubmit function()
  login() {
    if (this.user.email, this.user.password) {
      this.loading = true;
      this.userSrv.login(this.user.email, this.user.password); //api call here
      this.loading = false;
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

好的,我的服务.ts

import { Injectable } from '@angular/core';
import { Http, Headers, RequestOptions } from '@angular/http';
import { Router } from '@angular/router';
import { Globals } …
Run Code Online (Sandbox Code Playgroud)

javascript angular angular5

2
推荐指数
1
解决办法
3万
查看次数

标签 统计

angular ×1

angular5 ×1

javascript ×1