Angularのif構文における比較演算子
@if構文では、
比較演算子も使用できます。
その方法を見てみましょう。次のような 数値変数があるとします:
app/app.component.tsexport class AppComponent {
public num: number = 1;
}
条件に応じてテキストブロックを表示します:
app/app.component.html@if (num === 1) {
<div>
text
</div>
}
Задание 1
ageプロパティにユーザーの年齢が
格納されているとします。年齢が18歳より大きい場合、
成人向けのテキストを表示してください。