How to call a method from a JS file in Angular?
<p>I have <code>test.js</code> which contains:</p>

<pre><code>function test(str) {
    return 'Hello, ' + str + '!'
}
</code></pre>

<p>I want to use the test method in my Angular controller:</p>

<pre><code>angular.module('testModule')
.controller('testController', ['$scope', function($scope){
    console.log(test('John'))
}
</code></pre>

<p>Which returns <code>Hello, John!</code></p>

<p>I have tried:</p>

<pre><code>&lt;div ng-app="testModule" ng-controller="testController"&gt;
    &lt;script type="text/javascript"&gt;
        function test(str) {
            return 'Hello, ' + str + '!'
        }
    &lt;/script&gt;
&lt;/div&gt;
</code></pre>

<p>Which works as expected, returning <code>Hello, John!</code>. But trying to reference the method from my other <code>.js</code> files return <code>ReferenceError: ____ is not defined</code>.</p>

<ol>
<li>How can I call methods from other <code>.js</code> files in my Angular controller?</li>
<li>What is the best practice to call these methods? (e.g. Do I have to transfer the code in all my <code>.js</code> files into Angular's model or controller?)</li>
</ol>