8:00 – 5:00 SR
- Had a scary email from Ronda about the center where our servers live getting shut down sometime in June. I thought we had started this process, but maybe not?
- Meeting with Ronda at 4:00 on Monday.
- More Typescript/Angular integration. Today’s results!
- First, plain old angular HTML:
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
</head>
<body ng-app="simpleApp">
<div ng-controller="MainCtrl as mc">
<p>String = {{mc.myString}}</p>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.10/angular.min.js"></script>
<script src="simple.js"></script>
</body>
</html>
- Next, the TypeScript (simple.ts):
/// <reference path="../definitelytyped/angularjs/angular.d.ts" />
class TestClass{
myString:string;
constructor(){
this.myString = "Hello, TypeScript4";
}
}
class AngularMain{
myModule:ng.IModule;
myController:ng.IModule;
public doCreate(angular:ng.IAngularStatic, sfn:Function){
this.myModule = angular.module('simpleApp', []);
this.myController = this.myModule.controller('MainCtrl', [sfn]);
}
}
new AngularMain().doCreate(angular, TestClass);
- Last, the generated JavaScript code (simple.js):
/// <reference path="../definitelytyped/angularjs/angular.d.ts" />
var TestClass = (function () {
function TestClass() {
this.myString = "Hello, TypeScript4";
}
return TestClass;
})();
var AngularMain = (function () {
function AngularMain() {
}
AngularMain.prototype.doCreate = function (angular, sfn) {
this.myModule = angular.module('simpleApp', []);
this.myController = this.myModule.controller('MainCtrl', [sfn]);
};
return AngularMain;
})();
new AngularMain().doCreate(angular, TestClass);
//# sourceMappingURL=simple.js.map
