Skip to content
  1. We help small teams achieve big things.
  2. Our Technical Fellow just became a Microsoft MVP!
  3. We run the Azure Weekly newsletter.
  4. We just won 2 awards.
  5. We just published Programming C# 8.0 book.
  6. We run the Power BI Weekly newsletter.
  7. Our NDC London 2020 talk is now available online!
  8. We are school STEM ambassadors.
Matthew Adams By Matthew Adams Co-Founder
Avoid circular dependencies with AngularJS Directives

A problem you may encounter if you try to implement my previous example in your own code, is that your implementation of templateRepository cannot (apparently) make use of $templateCache, because angular will throw a circular dependency error.

To avoid this, you can inject the $injector service into the templateRepository, and defer the dependency resolution until you make the call.

Something like this:

Matthew Adams

Co-Founder

Matthew Adams

Matthew was CTO of a venture-backed technology start-up in the UK & US for 10 years, and is now the co-founder of endjin, which provides technology strategy, experience and development services to its customers who are seeking to take advantage of Microsoft Azure and the Cloud.