F
F
Friend2018-11-09 02:34:32
JavaScript
Friend, 2018-11-09 02:34:32

How to style nested components in Angular 2+?

Is it possible, is it necessary to create 1 component inside another if one uses the second one as a parent?
P is the main component, A is the parent of components B and C, and Z is the parent of Y and X
Created a project for learning. I'm wondering if there are any rules of good taste in this matter.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Q
Qairat, 2018-11-13
@Qairat

I usually create all the components in the components folder, but if I use them in several places, something like this:

-components:
  -A component
  -B component
  -C component

And if I know for sure that some component will be used only in one place, then I just create it where necessary, something like this:
-components:
  -A component
      -B component
  -C component

Plus, I have folders shared, pages,
inside shared -> pipes, directives, services, etc.
inside pages -> main components, such as main-page.component, login-page.component
The most important thing is to keep everything simple and clear. When the other person understood everything the first time, and intuitively.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question