Angular တွင် Template အတွင်း Component Class Method များကို ခေါ်ယူခြင်း

HTML markup အတွင်းမှလည်း class ၏ public method များကို ခေါ်ယူနိုင်ပါသည်။ လက်တွေ့စမ်းကြည့်ကြရအောင်။ ကျွန်ုပ်တို့တွင် အောက်ပါ method ရှိသည်ဟု ယူဆပါစို့။

app/app.component.tsexport class AppComponent {
  public show() {
    return 'abcde';
  }
}

၎င်းကို markup အတွင်းတွင် ခေါ်ယူကြည့်ပါ။

app/app.component.html<div>
  {{ show() }}
</div>
Задание 1

Component class အတွင်းတွင် အောက်ပါ method များရှိသည်ဟု ယူဆပါ။

app/app.component.tsexport class AppComponent {
  public showName() {
    return 'john';
  }
  
  public showSurn() {
    return 'smit';
  }
}

Component ၏ template file အတွင်းတွင် နာမည်နှင့် မျိုးနွယ်အမည်ကို ထုတ်ပြပါ။