如何根据布尔值更改Popover的数据内容?

时间:2018-09-17 16:31:29

标签: jquery html typescript

HTML:

<script>
  $(document).ready(function(){
      $('[data-toggle="popover"]').popover();   
  });
</script>

<button type="button" class="btn btn-outline-primary float-left" 
 (click)="showNotifications()"data-toggle="popover" title="Status"  data- 
 content="Success" data-trigger="hover">Notifications
</button> 


@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})

export class AppComponent {
  private status: string;
  private success: boolean = true;
  showNotifications() {
    if (this.success = !this.success) {
      return status = 'Success';
    } else return status = 'Failed';
  }
}

如果在showtification功能中状态值为false,则我希望此data-content =“ success”更改为“ failed”,如果为true,则我希望此操作成功。

0 个答案:

没有答案