I ended up putting it in a service and injecting it. Thanks. ..
On Jul 8, 2016 6:19 PM, "Steven Luke" <[email protected]> wrote:
> First, are you sure you want to use Data for that? Data is defined at the
> point where the route configuration occurs - usually at the start of the
> application, NOT when the user navigates. So you should make sure that the
> selectedPhysical is defined and has the intended value when the settings
> component is first loaded. Then, when you want to retrieve the data in the
> calculator component, you need to inject the RouteData in:
>
> export class CalculatorComponent {
> selectedPhysical : Physical;
>
>
> constuctor(data: RouteData) {
> this.selectedPhysical = data.get("physical");
> }
> }
>
> Remember that this is only useful if the selectedPhysical doesn't change.
> If it does change by user interaction/during the run of the app, then you
> need to use parameters to do pass the information along.
>
> Or maybe you can put the data in programmatically if the physical is an
> Object and not conducive to passing ids around:
> //in the settings component someplace...
>
> routeForCalculator = findCalculatorRoute(injectedRouter);
> routeForCalculator.data['physical'] = this.selectedPhysical;
>
>
>
> I am less sure of this second approach, but it would be worth a try. In
> my mind, if Physical exists, it should exist in some service which you can
> inject into the calculator, use an id in the calculator route as a
> parameter (rather than data), and pull the Physical out of the service in
> calculator. This would probably provide better navigation (deep linking,
> back/forward browsing). But maybe your situation doesn't allow that...
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "AngularJS" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/angular/KbDLqsxZDfA/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/angular.
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.