{{ fullName() }}
`, }) export class UserProfile { firstName = input(); lastName = input(); // `fullName` is not part of the component's public API, but is used in the template. protected fullName = computed(() => `${this.firstName()} ${this.lastName()}`); } ``` ### 変更されるべきでないプロパティには`readonly`を使用する {#use-readonly-for-properties-that-shouldnt-change} Angularによって初期化されるコンポーネントとディレクティブのプロパティを`readonly`としてマークします。 これには、`input`、`model`、`output`、およびクエリによって初期化されるプロパティが含まれます。 readonlyアクセス修飾子は、Angularによって設定された値が上書きされないことを保証します。 ```ts @Component({/* ... */}) export class UserProfile { readonly userId = input(); readonly userSaved = output(); readonly userName = model(); } ``` デコレーターベースの`@Input`、`@Output`、およびクエリAPIを使用するコンポーネントおよびディレクティブの場合、 このアドバイスは出力プロパティとクエリに適用されますが、入力プロパティには適用されません。 ```ts @Component({/* ... */}) export class UserProfile { @Output() readonly userSaved = new EventEmitter