如何向"x〃;通过单击Typescript代码中的按钮
<div>
<h3 >{{this.x}}</h3>
</div>
在TS文件中添加此
x: any;
changeX(){
this.x = your value;
}
在您的HTML文件中添加此
<button (click)="changeX()"></button>
<div>
<h3 >{{x}}</h3>
</div>