1

i noticed that AngularJS UI Bootstrap uses the following approach for templates:

angular.module("uib/template/progressbar/bar.html", []).run(["$templateCache", function($templateCache) {
  $templateCache.put("uib/template/progressbar/bar.html" }

So i think it's quite nice solution but what is the reason to create module for each template url like angular.module("uib/template/progressbar/bar.html" or angular.module("uib/template/progressbar/progress.html" etc

What benefits it will give to us?

1 Answer 1

1

Having a module for each template separately will result in proper separation of code. Each module will Handel the code for each template and will prevent the user from mixing the code. It's quite a universal rule that a function or entity should do only its own duty and not more that that.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.