Answer the question
In order to leave comments, you need to log in
What pattern to use in Angular?
I have a TreeService that manages a tree. It has a tree initialization method. In which the traversal of the tree is called and the selection of certain values according to the given logic. Then the draw method is called.
The problem is that I want to reuse the service, while not using part of the functionality, for example, not calling the above methods at the entry point, but executing my own logic.
At the same time, the current service contains common methods for any tree, mark a leaf, open, close a tree, and so on.
How to deal with this in Angular?
It comes to mind to create an abstract service class:
class abstract TreeCommon {
// Common methods and abstract methods for overwriing.
}
class TreeMap extends TreeCommon {
}
class TreeLayer extends TreeCommon {
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question