Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular - bind public/private properties

I'm doing angular tutorial at angular.io, where I read:

constructor(**public** messageService: MessageService) {}

The messageService property must be public 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!

like image 609
paroxyzm Avatar asked Nov 25 '17 16:11

paroxyzm


1 Answers

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
like image 52
Ankit Kapoor Avatar answered Nov 15 '22 07:11

Ankit Kapoor