In my front-end I want to use typescript with requireJs and AngularJs
I got typescript working with angularjs, but when I want to add requireJs nothing is working anymore. I hope someone can help me here :)
This is basically my structure:
In my index file i am refering the main file as my requireJs starting point
</script><script src="/components/requirejs/require.js" data-main="/js/main">
This is my main.ts
///<reference path="types/collection.d.ts"/>
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']]);
});
});
Last but not least my appsetup file, where i am loading my app:
///<reference path="../types/collection.d.ts"/>
/// <amd-dependency path="angular"/>
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;
Also Webstorm underlines angular in the require statement and says that it cant find it. Currently I am getting this error:
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)
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?