Closed
Description
TypeScript Version:
1.8.10
Code
MyService.ts
// A self-contained demonstration of the problem follows...
import {ngModule} from './../module.ts';
export class MyService {
}
ngModule.service('myService', MyService); // <- REALLY IMPORTANT SIDE-EFFECT
MyComponent.ts
import {MyService} from './MyService.ts';
class MyComponent {
constructor(private myService: MyService) { }
// ...
}
Expected behavior:
(I know this sort-of-tree-shaking is "by design", but by the principle of least astonishment, expected behavior is this)
MyComponent.js
var MyService_1 = require('./MyService');
var MyComponent = (function() {
function MyComponent(myService) {
this.myService = myService;
};
// ...
})();
Actual behavior:
MyComponent.js
var MyComponent = (function() {
function MyComponent(myService) {
this.myService = myService;
};
// ...
})();
And then AngularJS is all "myServiceProvider not found" and crashy.