In my unit tests, I want to inject some modules, and hook me up to before each Basically, I'm looking for something like this:
first (injection (function (_ $ rootScope_, _ $ compile_, done) {...}} ); However, this does not work, because the action complains that there is no provider named doneProvider . In fact, P Trying to see the donor.
Usually it is inserted in the first of all hooks:
first (done (done) {...}); But how can I inject and still before each can be asynchronous?
I also tried to put injector function inside first of every :
first each (function (done) {injection (function (_ $ rootScope_, _ $ compile_) { ... done ();});}); However When I do the test is time. For some reason, it seems that done can not be said inside the injected callback.
Any thoughts?
Div class = "post-text" itemprop = "text">
The solution is very simple;
first (injection (function (_ $ injector_) {$ injector = _ $ injector_;})); First each (function (done) {setTimeout (function () {console.log (found injector: '+ $ injector); done ();}, 100);}); SetTimeout is an example of async work if you can keep it there, just do not inject any async job and it will be fine.
Then you should use $ injector.get ('$ modal') or whatever you need.
No comments:
Post a Comment