javascript - How to dynamically display different components type based on runtime constraints in Angular2+? -


i have grid component , dynamically determined second component.

there splitter component contains grid in top part. secondary component displayed in bottom part of splitter. type of secondary component depend on selected row type in grid. select row 1 , secondary component might line chart select row 2 , secondary component might grid... user changes selected row, component , data displayed need updating.

any ideas on how set up?

you can dynamically load second component [ngswitch] directive.

if want dynamically load them, build code similar this

<div [ngswitch]="variable">     <app-first *ngswitchcase="1"></app-first>     <app-second *ngswitchcase="2"></app-second> </div> 

it's how determine component should loaded. can example change value of variable jquery of plain javascript render specific component. component automatically updated if change row.

if want automatically update content data 1st component matches 2nd, have use cross component communication provided angular4. explanation how here: https://www.youtube.com/watch?v=i317bhehzkm


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -