Well, in toastr provider your compile some html <div toastr-alert></div> which 
instanciates a toastrAlert directive which in turn requires toastr and 
there's your loop.

I would create a toastrContainer factory and have it manage the toastrs array 
and inject it in both toastrAlert and toastr

-MA

On Wednesday, February 12, 2014 7:22:14 PM UTC-5, Jesus Rodriguez wrote:
>
> Seems like I can't edit.
>
> I created a plunker: http://plnkr.co/edit/pKiT3xtG7MBS23DC8JrF?p=preview
>
> That is my library (WIP and subject to change, but the interface probably 
> will be the same and it is the problematic one)
>
> On Thursday, February 13, 2014 12:57:06 AM UTC+1, Jesus Rodriguez wrote:
>>
>> I am fighting a fight I cannot understand properly so I come here to get 
>> some knowledge.
>>
>> I am porting a jQuery directive to angular. It is to popup alerts. I 
>> decided to go to the ui-bootstrap $modal route, AKA a directive and a 
>> factory that will create new directives to append them to the body. So far 
>> so good, it works perfect for me.
>>
>> Even when it is really WIP I decided to swap the jQuery version for my 
>> version and I got a:
>>
>> Uncaught Error: [$injector:cdep] Circular dependency found: $interpolate 
>> <- $compile <- toastr <- $exceptionHandler <- $rootScope <- $route
>>
>> For what I understand, $exceptionHandler is really picky about what you 
>> inject and normally it suggest you to manual inject with $injector.
>>
>> My provider is something like:
>>
>> $get: ['$compile', '$document', '$rootScope', function($compile, $document, 
>> $rootScope) {
>>
>>
>> Both $compile and $rootScope are the problematic here.
>>
>>
>> My question are:
>>
>>
>> Why is $exceptionHandler so picky? I tried to reproduce my problem creating 
>> a controller using $rootScope and injecting also my provider and it works 
>> good. It only seems to fail with $exceptionHandler.
>>
>>
>> Should I change my $get? Since it compiles new alerts, I need $compile and 
>> also $rootScope (to give them a scope)
>>
>>
>> I tried manually getting my library on the exceptionHandler and nothing, it 
>> still fail and since it is a alert messages, it is normally used as logger 
>> and logging and $exceptionHandler are friends.
>>
>>
>> Ideas? Thoughts?
>>
>>

-- 
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/groups/opt_out.

Reply via email to