Using RequireJS with TypeScript and AngularJS

Topics: General, Language Specification
Aug 11, 2013 at 11:39 AM
I'm about to rip my brains out trying to define an Angular module in TypeScript while using RequireJS. Have looked all over for a solution while spending days trying to figure it all out to no avail. Please help, I'm soooooooooo completely confused!

I'm not using Visual Studio, but rather WebStorm. This shouldn't really matter however.
I'm using TS 9.1, AngularJS 1.0.7, RequireJS 2.1.8.
I've also tried using DefinitelyTyped's angular.d.td, but it's not helping.

Does anyone have a simple example of a TS angular app module for app init, with another TS angular module that has a controller, being loaded with RequireJS, referencing "DefinitelyTyped/angularjs/angular.d.ts", and calling 'angular.module' to define themselves, and then referencing the controller in a web page?

Please, help.... I'm burning in TypeScript, RequireJS, AngularJS module hell.
Aug 14, 2013 at 3:13 PM
Have you had a look on the basics of require.js with TypeScript here : http://blorkfish.wordpress.com/2012/10/23/typescript-organizing-your-code-with-amd-modules-and-require-js/

If so, could you post some sample code ?
Possibly the issue is related to the exports definition of your angular.js module.
Jan 27, 2014 at 2:10 PM
@phestermcs, did you find a solution? I'm also curious how to define this.
Feb 15, 2014 at 12:41 PM
Edited Feb 15, 2014 at 12:42 PM
I can't provide an answer to the specific question of phestermcs, but I started a similar discussion on linkedin, if you are interested you can read it here: Link to the discussion
Feb 24, 2014 at 7:56 AM
You should try Browserify. I use it with Gulp, but you could just as easily use it with Grunt.

This allows you to use Node.js style requires. You simply specify the file that is the entry point in terms of dependencies and Browserify will figure out the rest. It compiles everything down to one file while keeping all the modules isolated from each other.

Highly recommended reading: And just like that Grunt and RequireJS are out, it’s all about Gulp and Browserify now

For me, a big win has been the ability to package by feature instead of by layer, easily sharing some code between Node.js and AngularJS because they now use the same module system, at least at the source level.
Feb 25, 2014 at 3:40 AM
Edited Mar 2, 2014 at 8:59 AM
This reply retracted.