How to pass Property-bind to router-outlet at angular 2

Asked

Viewed 191 times

0

Hi, guys. I’m new to learning Angular 2 and I have this title question. My router-outlet: <router-outlet [busca]="termo"></router-outlet> with this Property-bind and returns me this error on the console:

Unhandled Promise rejection: Template parse errors: Can’t bind to 'search' Since it isn’t a known Property of 'router-outlet'.

Thank you in advance.

2 answers

2

I tbm think there is no way to do this... if you want to pass information from one component to another maybe it is better to create a service Shared

2


If I’m not mistaken, it’s not possible to pass a bind to router-outlet, it acts as only a selector that the Angular dynamically fills with the desired component based on the current state of the route. To better understand, what you would like with this bind? Play information dynamically to components? If yes, it is more interesting you work with parameters via route or even Input in its components

  • Exactly! I need to send information dynamically to a specific component. The interesting thing is that if I move to any component it works normally, but to the router-outlet it doesn’t. I’m learning, you know? I’m trying to follow the video lessons, but making my own modifications. I learned to change routes using the router-outlet, if you can help me to do some other way that would allow me to pass Binds to the components, I would appreciate it very much!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.