I have declared the following files
app.types.ts
/// <reference path="../../typings/tsd.d.ts"/>
module App{
export var Module = "website";
//---------------Controller Base Types---------------
export interface IScope extends ng.IScope {
events: Controller;
}
export class Controller{
protected scope: IScope;
static id : string;
constructor($scope: IScope,controllerId: string){
this.scope = $scope;
this.scope.events = this;
Controller.id = controllerId;
}
}
}
app.ts
/// /// <reference path="app.types.ts"/>
module App {
"use strict";
var app = angular.module(Module, [
// Angular modules
'ngMessages','ngAnimate','ngTouch','ngAria','ngSanitize',
// Custom modules
'ui.router','ui.bootstrap','ui.bootstrap.tpls'
// 3rd Party Modules
]);
}
The code compiles to Js without errors but the variable Module is undefined across the file.
I also tried using App.Module but still the variable was undefined
Update : I have check the app.types.js is inserted in the html before app.js. There generated Js files seem to be incorrect.
//App.js
(function(){/// <reference path="app.types.ts"/>
var App;
(function (App) {
"use strict";
var app = angular.module(App.Module, [
// Angular modules
'ngMessages', 'ngAnimate', 'ngTouch', 'ngAria', 'ngSanitize',
// Custom modules
'ui.router', 'ui.bootstrap', 'ui.bootstrap.tpls'
]);
})(App || (App = {}));
}());
//App.types.js
(function(){/// <reference path="../../typings/tsd.d.ts"/>
var App;
(function (App) {
App.Module = "website";
var Controller = (function () {
function Controller($scope, controllerId) {
this.scope = $scope;
this.scope.events = this;
Controller.id = controllerId;
}
return Controller;
})();
App.Controller = Controller;
})(App || (App = {}));
}());