I have dynamically added a component on the click of a button .
Below is the code for my widget . Simple div with color property being set as input.
var cmpRef = this.viewContainerRef.createComponent(this.componentFactory, 0); cmpRef.instance.someProp = 'someValue'; cmpRef.instance.someObservable.subscribe(val => this.someProp = val);