Setting *.prototype methods inside angular factory not working
<p>I'm creating an angular factory that encapsulates and injectable type that can be new-ed up as such:</p>

<pre><code>(function() {
angular
  .module('app')
  .factory('PaymentStream', [

function() {

    function PaymentStream(){

        this._endingBalance = null;
    }

    PaymentStream.prototype.serialize = function() {

        // method body here
    };

    return PaymentStream;

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

<p>When I create a PaymentStream via <code>new PaymentStream()</code> only the constructor seems to have been called.  If I don't use <code>prototype</code> and just define the methods inside the constructor it works but then I'm redefining the functions with each instance.</p>

<p>Any idea why those prototypes are not being set?</p>

<p><strong><em>Edit</em></strong></p>

<p>Here is how it is being used in the outside.</p>

<pre><code>    function addStreamFunctions(stream) {

        angular.merge(stream, new PaymentStream());
    }
</code></pre>