I am trying to understand which methods should be private and which should be publicly available in the component class.
It seems fairly easy to maintain to judge if the method is public or private, for example:
export class MyServiceClass { private _cache = {};
Following this logic, all methods in the component must be private, because none of the methods should be displayed outside the class. (in accordance with this post, the component and its presentation are one entity)
export class MyComponent { private _getRandomNumbers(){
There is no tragedy, but then in this video you can find out that only public methods of the component tested should be used. Following the above, I cannot find reasons to have public methods in the component class, but I still have some methods worth checking out (especially the methods used). This means that I completely lost the meaning of private and public methods in the angular world.
So my question is simple:
which methods in the components should be marked as public and private.
angularjs angular typescript
Lj wadowski
source share