Export an angular module as a commonjs module
<p>I'm writing an angular module that i want to make it work with requirejs,
This is an example:</p>

<pre><code>(function (){
    'use strict';

    var myModule = angular.module('myModule', [])

    .directive('myDirective', [function () {
        return {
            restrict: 'AE',
            scope: {
                item:    '=',
            },
            template: '&lt;span&gt;Item: {{ item }}&lt;/span&gt;'
        };
    }]);

  if (typeof module !== 'undefined') {
    module.exports = myModule;
  }

})();
</code></pre>

<p>Is this a good approach, if not, how should i export this, to make it work correctly?</p>