title: How to initialize - AngularJs app with TypeScript
body: <p>I've the following AngularJS App written with TypeScript</p>
  
  <p>The Main App where I initalize the App:</p>
  
  <pre><code>module MainApp {
     export class App {
        public static Module : ng.IModule = angular.module("mainApp", [])
     }
  }
  </code></pre>
  
  <p>And my controller</p>
  
  <pre><code>module MainApp {
     export class Person {
       public firstName: string;
       public lastName: string;
     }
  
     export  interface IMainAppCtrl {
  
     }
  
     export class MainAppCtrl implements IMainAppCtrl {
        public person : Person;
        constructor() {
            this.person = new Person();
            this.person.firstName = "Vorname";
            this.person.lastName = "Nachname";
        }
    }
  
    MainApp.App.Module.controller("mainAppCtrl", MainAppCtrl);
  }
  </code></pre>
  
  <p>Thats working, but I am not very happy with this solution, because here I have to register the controller for my App in my controller itself</p>
  
  <pre><code>MainApp.App.Module.controller("mainAppCtrl", MainAppCtrl);
  </code></pre>
  
  <p>It would be nice If ther is a possiblity to register the controller in the "App" class directly like:</p>
  
  <pre><code>public static Module : ng.IModule = angular.module("mainApp", []).controller("mainAppCtrl", MainAppCtrl);
  </code></pre>
  
  <p>but thats not working here i get the error Message from the browser </p>
  
  <p>"Argument 'mainAppCtrl' is not a function, got undefined"</p>
  
  <p>in my old plain JS angular controllers I had an mainApp where I've registered all my Controllers like</p>
  
  <pre><code>angular.module("app.main", [
      "ui.router",
      "ngSanitize",
      "DirectiveTestsCtrl",
      ....
  ]);
  </code></pre>
  
  <p>and in my controller i've only registerd the controller name for angular:</p>
  
  <pre><code>angular.module("DirectiveTestsCtrl", [])
         .controller("DirectiveTestsCtrl", function () { ... });
  </code></pre>
  
  <p>is this also possible with the above shown snipes with typescript or what is best practise here - I've searched the web and found many examples but not a good one for controlerAs syntax and with "module Name { class xyz }" which was really working.</p>