在 angular 5 中添加 class 到点击按钮的段落

Adding a class to para onclicking a button in angular 5

我想在单击编辑字体图标后将 class 添加到我的段落中。谁能帮我这个?谢谢。

<style>
 .cust-style{
    border-bottom: 1px solid #ef4048;
    display: inline-block;
    outline: none;
}
</style>
<p class="cust-style">Need to add a class for thisd paragraph</p>
<i class="fa fa-pencil" aria-hidden="true"></i>
 <p [ngClass]="isClicked ? 'addClassHere' : ' '"></p>

  <i (click)=addClass()></i>

in component.ts 
  isClicked: boolean = false
   toggleClass(){
    this.isClicked = !this.isClicked
    // or this.isClicked = true; // for adding class once
  }

class 将在单击时添加和删除

希望这段代码对您有所帮助!谢谢

<p [attr.contenteditable]="isClicked" [ngClass]="{ 'className': isClicked }">Hello World!</p>
<button (click)="isClicked = !isClicked">Add Class</button>