I am trying to use typescript to build an angularjs (1.5) application.
I want to make the equivalent of a factory that calls a model (which can take parameters).
I could do the following if I were to do it in pure JS
angular.module('test', [])
.factory('Talker', [$q, function($q){
return Talker()
function Talker(name) {
this.name = name || 'Bobuel Johnson';
}
Talker.prototype.deferredHello = function(){
$q.when('Hi, I\'m ' + this.name);
}
}])
Now I want to do this in typescript such that I can have the Talker class but I want to be able to inject (in this case) $q into the model class.
Please, can you help me figure out how to get this set up as the typescript equivalent?