None
None

Reputation: 9247

How to change component places on click?

What i want when user click on some button to change place for that component. I want to put some component on first place. Can i achive that? Any suggestion?

So if i have something like this:

<default-component></default-component>
<first-component></first-component>

So on click to be like this:

<first-component></first-component>
<default-component></default-component>

Is that possible to do?

Upvotes: 0

Views: 1030

Answers (1)

Shailesh Ladumor
Shailesh Ladumor

Reputation: 7252

create one variable for that and display like that.

<first-component *ngIf="isClicked"></first-component>
<default-component></default-component>
<first-component *ngIf="!isClicked"></first-component>

change a value of isClicked variable (click)="onClicking"

component

onClicking(): void {
this.isClicked = !this.isClicked;
}

Upvotes: 1

Related Questions