Difference between & usage of JavaScript & AngularJs Modules
<p>The below code shows you a JavaScript Module <strong>(revealing pattern):</strong></p>

<pre><code>var module = (function(){

    var _privateMethod = function(){
      //code here
    }

    var publicMethod = function(){
      //code here
    }

    return {
       publicMethod: publicMethod
    }

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

<p>The above revealing module pattern has a lot of advantages such as:</p>

<ol>
<li>Provides public &amp; private methods (Encapsulation)</li>
<li>App functionality can be divided into multiple modules</li>
<li>Easier to scale and debug in future</li>
</ol>

<p><strong>So far I have been using the above Module Pattern within my apps and it has worked fine</strong></p>

<p>Now I am trying to use <strong><em>AngularJs</em></strong> in my app. The thing thats confusing me is how to use the Angular Modules and JavaSscript Modules (see above) <strong>together</strong>?</p>

<p>A normal JavaScript Module (see above) provides encapsulation which is very important as JavaScript itself does not contain the private &amp; public feature.</p>

<p>So <strong>my question</strong> is when working with angularJs modules is there any point of using JavaScript modules? </p>

<p>Should I divide my app functionality into angularJS modules? </p>

<p>Is there any difference between the angular modules we define &amp; the JavaScript module pattern shown above?</p>

<p>I think the terminology "module" is confusing me. I apologise if this question seems too broad but even trying explain this question is hard for me.</p>