Angular 角度4隐藏按钮

Angular 角度4隐藏按钮,angular,button,frontend,Angular,Button,Frontend,当我单击第一个按钮时,我如何显示第二个按钮和隐藏第一个按钮,并希望单击第二个按钮,然后显示第一个按钮和隐藏第二个按钮 <button class="btn" type="button" name="button" (click)="follow()">follow</button> <button class="btn" type="button" name="button" (click)="followed()">followed</button&g

当我单击第一个按钮时,我如何显示第二个按钮和隐藏第一个按钮,并希望单击第二个按钮,然后显示第一个按钮和隐藏第二个按钮

<button class="btn" type="button" name="button" (click)="follow()">follow</button>
<button class="btn" type="button" name="button" (click)="followed()">followed</button>
跟随
跟着
试试这个

<button class="btn" type="button" [disabled]="!disableBtn" name="button" (click)="follow()">follow</button>
<button class="btn" type="button" [disabled]="disableBtn" name="button" (click)="follow()">followed</button>
这是正在工作的

试试这个

<button class="btn" type="button" [disabled]="!disableBtn" name="button" (click)="follow()">follow</button>
<button class="btn" type="button" [disabled]="disableBtn" name="button" (click)="follow()">followed</button>

如果我正确理解了这个问题,我认为这更重要的是使两个按钮可见/隐藏,以启用/禁用它们

这可能就是我要做的

<button class="btn" type="button" *ngIf="isVisible" name="button" (click)="toggle()">follow</button>
<button class="btn" type="button" *ngIf="!isVisible" name="button" (click)="toggle()">followed</button>

export class AppComponent { 
    public isVisible: boolean = true;
    toggle() {
        this.isVisible = !this.isVisible;
    }
}
跟随
跟着
导出类AppComponent{
public isVisible:boolean=true;
切换(){
this.isVisible=!this.isVisible;
}
}

如果我正确理解了这个问题,我认为更重要的是使两个按钮可见/隐藏,就像启用/禁用它们一样

这可能就是我要做的

<button class="btn" type="button" *ngIf="isVisible" name="button" (click)="toggle()">follow</button>
<button class="btn" type="button" *ngIf="!isVisible" name="button" (click)="toggle()">followed</button>

export class AppComponent { 
    public isVisible: boolean = true;
    toggle() {
        this.isVisible = !this.isVisible;
    }
}
跟随
跟着
导出类AppComponent{
public isVisible:boolean=true;
切换(){
this.isVisible=!this.isVisible;
}
}