Angular Public Private accessors

Viewed 94

Quick question. In an existing angular application there are methods that are not signified by the accessor 'public' just the method name such as updateCustomer(params). Is it good practice to have the accessor in angular preceding the method or cleaner? I believe that is the case that those methods are just public by default but not sure of best practice. Maybe it is simply a preference.

1 Answers

You're correct: they are public by default. As for if it's good practice to add them, I would say it's just personal preference and there's not any real convention we've landed on. Just stay consistent, whether that be prepending everything that's public with public, or just leaving it to it's default behaviour.

Related