-
Notifications
You must be signed in to change notification settings - Fork 27.1k
Closed
Labels
breaking changeseffort2: daysrefactoringIssue that involves refactoring or code-cleanupIssue that involves refactoring or code-cleanup
Milestone
Description
Right now, Angular has 2 ways of loading dynamic components:
- Using a
@Componentthat does not have a view and dynamically loads another component onto the same element including the view of that component - Using a regular
@Directivethat creates a host view via aViewContainer(i.e. a View that contains the host element of the component)
Option 1) has the following downsides:
- it allows having 2 component instances on the same element, including possible 2 app injectors on it, which can have unexpected corner cases. It can also lead to a component without a view at all.
- it does not handle animations, as we can't animate adding a shadow root. I.e. if a user wants to use option 1) + animations, he needs to use a
ViewContainerany ways - the only customer (GT) for which we designed it actually needs the host element
We should change option 1) into also creating a host view but inserting it as a child of a given ElementRef.
Note that this would also allow to remove 1 method from the Compiler, leaving only one public method.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
breaking changeseffort2: daysrefactoringIssue that involves refactoring or code-cleanupIssue that involves refactoring or code-cleanup