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,则我希望此操作成功。