scs.couch-potato module

Loading the Script

Couch Potato needs RequireJS in order to be useful. However, it is not necessary for your application to be bootstrapped using AMD. You have two options:

A. Use Traditional <script> Tags

If you use traditional script tags to load the module (i.e. you aren't using AMD to structure your the non-lazy portion of your application, you must load the following three scripts in this order (other modules can be loaded wherever it makes sense for you, but these three must follow the order):

  1. Angular
  2. Couch Potato
  3. RequireJS

      <!-- in index.html -->
      <script src="/js/angular.min.js"></script>
      <script src="/js/angular-couch-potato.min.js"></script>
      <script src="/js/require.min.js"></script>
      

B. Use RequireJS

If you use RequireJS, Couch Potato will first try to use an AMD module that is defined with the name 'angular'. If it does not find that, it will try to use an angular object defined as window.angular. This flexibility allows you to load angular from a script tag (if you do so before your require.js script tag) or from RequireJS -- the distinction will be critical if you are using multiple instances of angular (in which case I pity you for needing to, even though I understand that there are edge cases where it is necessary) -- it must be very painful.

Adding Couch Potato as a Dependency

Reference Couch Potato as a Dependency as follows:

var myModule = angular.module('myApp', ['myOtherDep', 'scs.couch-potato']);

See also the $couchPotatoProvider documentation.