title: AngularJS factory to call new on external js
body: <p>I am using AceEditor JavaScript library in my project. I want to use it via an Angular service, not by calling <code>new</code> on it. </p>
  
  <p>Instead of this inside my controller:</p>
  
  <pre><code>$scope.ace = new AceEditor('my-editor-div');
  </code></pre>
  
  <p>I have created a factory for a service:</p>
  
  <pre><code>myapp.factory('AceService', function() {
  
      this.init=function(name) {
          return new AceEditor(name);
      };
  
      return this;
  });
  </code></pre>
  
  <p>Which I call in my controller like this:</p>
  
  <pre><code>$scope.ace = AceEditorService.init('my-editor-div');
  </code></pre>
  
  <p>Am I doing this the correct Angular way? </p>