Skip to content
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

[Question] RouteComponentDirective seems obsolete #35

Closed
meeroslav opened this issue Jul 23, 2020 · 2 comments
Closed

[Question] RouteComponentDirective seems obsolete #35

meeroslav opened this issue Jul 23, 2020 · 2 comments

Comments

@meeroslav
Copy link
Collaborator

Based on the code, the sole purpose of RouteComponentTemplate is to provide TemplateRef for RouteComponent to use as the container outlet. These are equivalent:

  • Current custom directive
<route path="/blah">
  <app-something *routeComponent></app-something>
</route>
  • Any structural directive
<route path="/blah">
  <app-something *ngIf></app-something>
</route>
  • No directive, just template
<route path="/blah">
  <ng-template>
    <app-something></app-something>
  </ng-template>
</route>

Seems unnecessary to define custom directive when ng-template within RouteComponent could solve this.

What was the reasoning behind it? Is RouteComponentTemplate planned to have some logic in the future?

@brandonroberts
Copy link
Collaborator

Yep, they are equivalent, and that's why I added it just so the user doesn't have to remember to wrap every component in an ng-template or a unnecessary ngIf. I'd like to do something like #37 if possible

@meeroslav
Copy link
Collaborator Author

Yup, will look into it. I’ll close this in favor of #37

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants