I dynamically create some components like:
let comFac = this.componentFactoryResolver.resolveComponentFactory(com)
let newCom: ComponentRef<any> = viewContain.createComponent(comFac)
newCom.changeDetectorRef.detectChanges()
Then I push the newCom
into a temp array like:
this.comArr.push(newCom)
And the viewContain
can show these components'view correctly.Now I want to dynamically sort these components' view by some operations like drag them.How to make the viewContain
can show the view after components were dragged but not create them(components) again?
You can try
viewContain.move(newCom.hostView, someNewIndex);
See also
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.