I think you're missing the FindService in your providers that are passed to
bootstrap. I do not see it referenced.

As long as a provider is specified for each injectable, this should work.

On Tue, Jul 5, 2016 at 10:39 AM, HisDivineShadow <
[email protected]> wrote:

> So, after some further reading I found that the parent component (i.e. the
> app component in this case) needs to have a provider for the injected
> service specified in any classes that are used within the component (even
> if they are services that are use indirectly like mine is).  So, I added
> the provider for the findService to my app component's provider list and it
> worked.  I think ng2's DI is strange in that my component is reliant on the
> parent component to know what service need to be injected in my class.  The
> find service is using hte AuthService which is specified in my bootstrap.
> I would have expected that the AuthService would be injected as a result of
> it being specified in bootstrap.
>
> *BOOTSTRAP*
>
> import {APP_ROUTER_PROVIDERS} from "./app.routes";
>
>
> bootstrap(App, [APP_ROUTER_PROVIDERS, disableDeprecaedForms(), 
> provideForms()])
>
>     .catch((err: any) => console.error(err));
>
>
>
>
> *app.routes*
>
> import { provideRouter, RouterConfig } from '@angular/router';
> import { AuthService } from './authservice';
>
> import { AuthGuard } from './authorize';
>
> export const routes: RouterConfig = [
>     //some routes
> ];
>
>
> export const APP_ROUTER_PROVIDERS = [
>     provideRouter(routes),
>     AuthGuard,
>     AuthService
> ];
>
>
>
>
>
>
>
>
> On Tuesday, July 5, 2016 at 9:06:19 AM UTC-5, Lucas Lacroix wrote:
>>
>> I do not see your component with it's list of providers nor do I see your
>> bootstrap call with the list of providers.
>>
>>>
>>> --
>>> 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.
>>>
>>
>>
>>
>> --
>> Lucas Lacroix
>> Computer Scientist
>> System Technology Division, MEDITECH <http://ehr.meditech.com>
>> 781-774-2293
>>
> --
> 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.
>



-- 
Lucas Lacroix
Computer Scientist
System Technology Division, MEDITECH <http://ehr.meditech.com>
781-774-2293

-- 
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.

Reply via email to