Home > database >  Adjusting the position of a component in Angular
Adjusting the position of a component in Angular

Time:07-11

I have the first component that calls the second component. The second component renders under the first component. What I want to achieve is the second component will render beside the first component. I have no clue if I should be editing the html or the css files of the components.

CodePudding user response:

Is it what you really want? I think you need one component to call component one and component two, maybe we can call the container component.

https://stackblitz.com/edit/angular-ivy-fkg3uj?file=src/app/app.component.html

CodePudding user response:

From the above Question, what I understand is that you want one component beside another. What I suggest doing is to make use of the main component which will import both the first and second components. This will help you in data sharing also and placing the two components adjacent. Here is a link for the repo where I have utilized the same technique. git repo link for example

To use the above example project, step 1: clone the repo step 2: execute 'npm install' to install node-modules step 3: then 'ng serve' to see the results in the browser listens to localhost:4200.

If you want to call a component within the component and show it beside each other, then drop a message.

  • Related