Use external class in AngularJs controller
<p>I don't quite follow how to inject external constructors, I have this constructor:</p>

<pre><code>function myAudio(url){
    var song = new Audio();
    song.crossOrigin = "anonymous";
    song.src = url;
    var source  = context.createMediaElementSource(song);
    source.connect(context.destination);

    this.play = function(){
        source.mediaElement.play();
    } 

}
</code></pre>

<p>outside, just with Javascript it works ok. I can create objects using <code>var myVar = new myAudio("some_url")</code></p>

<p>I want to use that constructor inside an AngularJS controller but I just can't figure out how to do it.</p>

<p>I tried declaring it in the controller without success</p>

<pre><code>app.controller("myAppCtrl", myMainFunction);
myMainFunction.$inject = ["$interval", "myAudio"];
function myMainFunction($interval, myAudio) {
   scope = this;
   //my controller stuff
}
</code></pre>

<p>Tried to make it return an object but I didn't find the correct way to do it.</p>

<p>I don't know what I am missing...</p>