mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
96c6139c9a
This change adds the setInput method to the ComponentRef. Previously users had to call `componentRef.instance['inputName']` to change inputs of a dynamically created component. This had several problems: * OnPush components were not marked for check and thus very difficult to test; * input aliasing was not take into account - a property name on a component could have been different from the actual input name so setting input properties was fragile; * manually setting input propertie would NOT trigger the `NgOnChanges` lifecycle hook. This modifications unifies `@Input` accross dynamically created components and the ones referenced in templates. This also opens doors to other changes: as an example router could use this new method to set `@Input`s from router params. Closes #12313 Closes #22567 PR Close #46641