Take a look at this plunker:
http://plnkr.co/edit/UyNe7a4wD3OWXGTyWlAI?p=preview

I took one of the templates from the angular website and extended it -- One
thing to note (and I'm not sure if this is intentional or not, doesn't seem
to be necessary with di.js), I had to include @Component injectables as
[Service, AnotherService], instead of just the parent dependency of
AnotherService. Try it for yourself -- if I remove Service from that array,
the whole thing breaks for me.

Whether that's intentional behavior or not, I'm not sure, but that's what I
saw earlier with the dependency injection in the quickstart code as well.

On Fri, Apr 24, 2015 at 3:15 AM, Milan Pevec <[email protected]> wrote:

> So this should work or did I miss something ?
>
> http://plnkr.co/edit/ehV8PojejoTk1h28VsPb?p=preview
>
> Milan
>
>
> On Friday, April 24, 2015 at 10:34:02 AM UTC+2, Milan Pevec wrote:
>>
>> Thank you for the answer and yes I see the same error..
>>
>> Milan
>>
>> On Thursday, April 23, 2015 at 6:50:58 PM UTC+2, David Lesage wrote:
>>>
>>> Yes and no -- My next step was to update the Angular2 code by grabbing
>>> it off of github, followed by grabbing all of the dependencies myself
>>> (SystemJS, Traceur, etc) and starting from scratch. I eventually got it
>>> into a state where all of the injection *mostly* worked, but I was
>>> getting an issue where multiple injections of the same type in different
>>> locations were not the same instance, and I was getting some unexpected
>>> behavior while trying to create a local cache/store/whatever you want to
>>> call it. That was either a bug (unlikely), a user-error (seems more
>>> likely), or just me misunderstanding the dependency injection expectations
>>> in Angular2.
>>>
>>> At that point I broke it down further, and I grabbed the di.js
>>> <https://github.com/angular/di.js/> code directly from Angular's github
>>> and ran with that separately to make sure my expectations weren't incorrect
>>> -- but that worked exactly as I expected. Phenomenally, in fact -- I loved
>>> it. They have better examples
>>> <https://github.com/angular/di.js/tree/master/example/kitchen-di>than
>>> anything I could give, though.
>>>
>>> I suppose the TL;DR is -- No, I never got it fully working. Are you
>>> seeing the same error I was?
>>>
>>>
>>> On Thursday, April 23, 2015 at 7:42:25 AM UTC-7, Milan Pevec wrote:
>>>>
>>>> Hi David,
>>>>
>>>> did you maybe find the solution ?
>>>>
>>>> Regards,
>>>> Milan
>>>>
>>>> On Friday, April 3, 2015 at 7:01:37 PM UTC+2, David Lesage wrote:
>>>>>
>>>>> Absolutely, that looks perfect. Is that syntax functional, or just
>>>>> proposed? I'm wondering if I need a newer version of Angular2 than what is
>>>>> included with the quickstart to get that to work.
>>>>>
>>>>> I'm currently not having any luck with the following:
>>>>>
>>>>> import {DispatcherService} from 'services/DispatcherService';
>>>>> import {Inject} from 'angular2/di';
>>>>>
>>>>> @Inject(DispatcherService) // had to remove the semicolon, was
>>>>> getting an 'Unsupported annotated expression' error
>>>>> export class TodoStore {
>>>>>   constructor(dispatcher: DispatcherService) {}
>>>>> }
>>>>>
>>>>> I am still receiving the *No provider for DispatcherService!
>>>>> (TodosComponent -> TodoStore -> DispatcherService) *error.
>>>>>
>>>>>
>>>>> On Friday, April 3, 2015 at 2:28:19 AM UTC-7, Sander Elias wrote:
>>>>>>
>>>>>> Hi David,
>>>>>>
>>>>>> You mean you want somethig like this:
>>>>>>
>>>>>> export function threeStrikes (req:Request|string) {
>>>>>>   return this.http(req).retry(3);
>>>>>> }
>>>>>>
>>>>>> @Inject(threeStrikes);
>>>>>> export class MyComponent {
>>>>>>   constructor(threeStrikes) {
>>>>>>     threeStrikes('[http://foo.bar](http://foo.bar/)').subscribe(onNext, 
>>>>>> onError);
>>>>>>   }
>>>>>> }
>>>>>>
>>>>>> This is a Sample Jeff provided in another setting, but I think it is
>>>>>> what you are asking, right?
>>>>>>
>>>>>> Regards
>>>>>> Sander
>>>>>> ​
>>>>>>
>>>>>  --
> 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/PPl6jxL5zps/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 http://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 http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to