Component သည် Angular application ၏ အခြေခံအကျဆုံး building block ဖြစ်သည်။ Component တစ်ခုတွင် အပိုင်းသုံးပိုင်းပါဝင်သည်:
• TypeScript Class: Component ၏ logic နှင့် data များ (properties & methods)
• HTML Template: Component ၏ UI
• CSS Styles: Component အတွက်သာသက်ဆိုင်သော styles များ
typescript
// user-profile.component.ts
import { Component } from '@angular/core';
@Component({
selector: 'app-user-profile',
templateUrl: './user-profile.component.html',
styleUrls: ['./user-profile.component.css']
})
export class UserProfileComponent {
username = 'John Doe';
}You should see
(HTML template တွင် {{ username }} ကိုသုံးခြင်းဖြင့် 'John Doe' ဟုပြသမည်)