In AngularJS I was able to do this:
angular.module('myApp').service('myService', [ function () {
this.loadConfiguration = function () {
};
this.loadConfiguration();
}]);
How do I achieve the same thing, call one function before others in a service, in Angular 2 in TypeScript?
I tried:
@Injectable()
export class ChatService {
ngOnInit() {
this.loadConfiguration();
}
loadConfiguration() {
}
}
And it doesn't work.
constructor()