I'm doing angular tutorial at angular.io, where I read:
constructor(**public** messageService: MessageService) {}
The
messageService
property must bepublic
because you're about to bind to it in the template.Angular only binds to
public
component properties.
I emphasize public
there.
However, if I change public
to private
there, everything works as before...
So please guide me to place where I can dispel my doubts.
My Angular version: 5.0.0,
Thank you!
This is just a recommendation so that your project is compatible with AOT (Ahead Of Time) type build process. You can see its impact by creating an AOT build with this command:
ng build --prod
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With