Angular 18 - 访问修饰符
原文约100字/词,阅读约需1分钟。发表于: 。Faz sentido utilizar o readonly em serviços? private toastService = inject(ToastService); ou private readonly toastService = inject(ToastService);
在服务中使用readonly是有意义的。可以选择使用private toastService = inject(ToastService)或private readonly toastService = inject(ToastService)。