ComponentRef.setInput assigns an input on a dynamically created Angular component while preserving change detection and component lifecycle behavior. Direct instance assignment changes the property but does not immediately trigger change detection or invoke ngOnChanges. section 4.1.4
Updating a dynamic loader
A loading directive creates LoaderComponent dynamically, passes its projected content, and calls loaderRef.setInput('loading', this.loading) during initialization and subsequent changes. This keeps the dynamic component synchronized with the directive input.
