-
Notifications
You must be signed in to change notification settings - Fork 26.9k
feat(NgComponentOutlet): add NgComponentOutlet directive #13383
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
We found a Contributor License Agreement for you (the sender of this pull request) and all commit authors, but as best as we can tell these commits were authored by someone else. If that's the case, please add them to this pull request and have them confirm that they're okay with these commits being contributed to Google. If we're mistaken and you did author these commits, just reply here to confirm. |
|
@mhevery I have pushed the updated code to my branch. Tests are passing. It includes a rebase + all the requested changed except the namings. I didn't have time to edit my WIP comminets so commits should be squashed :) There are some lines of codes commented out in the tests since Output is not supported in * syntax. I think you should use it as a baseline |
|
@shlomiassaf thanks, i am also making sure that |
7b04d63 to
6406369
Compare
|
@vicb ready for review. |
|
So how long does it take on average for a PR like this to be reviewed? (Just would like to know, not 'pushing'). This NgComponentOutlet seems usefull! |
|
Holiday season I guess (:
…Sent from my iPhone
On Dec 30, 2016, at 3:48 PM, Maxim Crabbé ***@***.***> wrote:
So how long does it take on average for a PR like this to be reviewed? (Just would like to know, not 'pushing'). This NgComponentOutlet seems usefull!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about @Input('ngTemplateOutletContext') public context: Object;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO it is better as-is
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about @Input('ngTemplateOutlet') public template: TemplateRef<any>;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO it is better as-is
|
LGTM, please rebase and consider the minor comments. |
|
Rebased |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we change it so only views we've created are destroyed here? In theory we could have multiple directives sitting on the same <template> element, they could be creating their own views and this logic would mess up views created by other directives, no?
This is what is done in the template outlet:
angular/modules/@angular/common/src/directives/ng_template_outlet.ts
Lines 48 to 50 in 35f9a1c
| if (this._viewRef) { | |
| this._viewContainerRef.remove(this._viewContainerRef.indexOf(this._viewRef)); | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point. Fixed
BREAKING CHANGE: - Deprecate `ngOutletContext`. Use `ngTemplateOutletContext` instead
Add NgComponentOutlet directive that can be used to dynamically create host views from a supplied component. Closes angular#11168 Takes over PR angular#11235
| // #docregion CompleteExample | ||
| @Injectable() | ||
| class Greeter { | ||
| suffix = '!' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[32, 15]: Missing semicolon.
| * Instantiates a single {@link Component} type and inserts its Host View into current View. | ||
| * `NgComponentOutlet` provides a declarative approach for dynamic component creation. | ||
| * | ||
| * `NgComponentOutlet` requires a component type, if a falsy value is set the view will clear and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should probably be if a false value instead of if a falsy value.
|
@mhevery please fix CI issues. |
|
Landed as 8578682 |
|
Sorry I am not so familiar with how big open source projects work. Is this feature now implemented? (I think so in 8578682 commit) however what version of angular do I need, I guess it will be 2.5 or something ? |
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
feat(NgComponentOutlet): add NgComponentOutlet directive
Add NgComponentOutlet directive that can be used to dynamically create
host views from a supplied component.
Closes #11168
Takes over PR #11235