【发布时间】:2016-10-20 23:42:28
【问题描述】:
我是 Typescript 和 Angular 2 的新手。我试图在网上寻找答案,但它们似乎不适合我。
假设我有一个 app.component 如下所示:
export class AppComponent{
cartPayableAmount = 0;
........
}
in my app.component.html, the cartPayableAmount is used here
<div> {{cartPayableAmount}} </div>
现在我想访问其他类中的 cartPayableAmount 实体,如下所示:因此,当我调用 TestHere() 时,cartPayableAmount 的值将发生变化,并将反映在 app.component.html 中。
export class BuyTestComponent {
TestHere() {
// should update cart PayableAmount here.....
cartPayableAmount = "Some value"
}
}
请帮忙。谢谢
【问题讨论】:
标签: angular typescript