0
result
に保存されている値に基づいてhtmlファイルのボタンを表示するにはどうすればいいですか?さまざまな値に応じてボタンを表示する方法
page1.ts
class page1 {
let result: string; //possible values of result can be 'additon',
//'multiply','divide'.
constructor(public serviceClass : ServiceClass){
this.initialzie();
}
additon(){
this.result = 'addition';
}
modulus(){
//logic for this function.
}
initialize(){
this.result = this.serviceClass.someFunction();
}
}
page1.html
//headers and title already implemented.
// buttons to implement now.
//**condition**: The below button is only shown on the basis of the value
//populated in the result variable in .ts class.
<div> //if result = 'multiply, 'divide' then show this button.How to
//implement this?
<button ion-button (click)="addition()">ADD ME</button>
</div>
<div> //if result = 'addition' then show this button.How to implement this?
<button ion-button (click)="modulus()">Modulus</button>
</div>
を使用することができます追加 'ボタン'Modulus'で置き換えられません – Aditya
あなたの追加関数 –
はどこかで' result = addition'の値を更新するので、値が 'addition'に変わると、ボタンは' Modulus 'これは私が実装する必要があるロジックです。 – Aditya