Why attributes modified by private in angular4 can still be accessed outside the class

Why can the properties modified by private in angular4 still be accessed outside the class? vscode gives an error prompt marked red, but the browser still outputs, with no error

.
Jul.01,2021
The public private in

ts is only used for static checking, and


ts will eventually be translated into js instead of being used directly, that is to say, it is still executed in the browser that the js,js itself does not have permission modifiers.
is more used to prevent scope confusion and constraints of variables during development.

Menu