title: Typescript + RequireJs + AngularJs
body: <p>In my front-end I want to use typescript with requireJs and AngularJs</p>
  
  <p>I got typescript working with angularjs, but when I want to add requireJs nothing is working anymore. I hope someone can help me here :)</p>
  
  <p>This is basically my structure:</p>
  
  <p><img src="https://i.stack.imgur.com/swblr.jpg" alt="http://i.imgur.com/yGVnqWK.jpg"></p>
  
  <p>In my index file i am refering the main file as my requireJs starting point</p>
  
  <pre><code>&lt;/script&gt;&lt;script src="/components/requirejs/require.js" data-main="/js/main"&gt;
  </code></pre>
  
  <p>This is my main.ts</p>
  
  <pre><code>///&lt;reference path="types/collection.d.ts"/&gt;
  
  require.config({
      baseUrl: '/js/',
      paths: {
          angular: '/components/angular/angular',
          angularRoute: '/components/angular-route/angular-route'
      },
      shim: {
          'angular': {'exports': 'angular'},
          'angularRoute': ['angular']
      },
      priority: [
          'angular'
      ]
  });
  
  require( [
      'angular',
      'app/appsetup'
  ], function(angular, app) {
      'use strict';
      $(document).ready(function () {
          var $html = $('html');
          angular.bootstrap($html, [app.app['name']]);
      });
  });
  </code></pre>
  
  <p>Last but not least my appsetup file, where i am loading my app:</p>
  
  <pre><code>///&lt;reference path="../types/collection.d.ts"/&gt;
  /// &lt;amd-dependency path="angular"/&gt;
  
  import controller = require("./../controllers/home/index");
  import angular = require("angular");
  
  export var app = angular.module('app', ['ngRoute'])
                          .controller('app.controllers.home.index', controller.HomeController);
  
  return app;
  </code></pre>
  
  <p>Also Webstorm underlines angular in the require statement and says that it cant find it.
  Currently I am getting this error: </p>
  
  <blockquote>
    <p>Uncaught Error: [$injector:modulerr] Failed to instantiate module app
    due to: Error: [$injector:nomod] Module 'app' is not available! You
    either misspelled the module name or forgot to load it. If registering
    a module ensure that you specify the de......0)</p>
  </blockquote>
  
  <p>Do you guys know what I am doing wrong? Or do you have maybe some links to pages, where I can see how you can develop with these 3 technologies for large projects?</p>