I have been writing AngularJS apps for awhile now, but Typescript is new to me, and then adding in AngularJS to Typescript is a bit different than I am use to.
Anyways, what is the difference between the two:
app.service('customerDataService', Application.Services.CustomerDataService);
and
app.service('customerDataService', ['$http', '$q', Application.Services.CustomerDataService]);
Controller TS
module Application {
export module Services {
export interface ICustomerDataService {
getCustomer(id: number): ng.IPromise<Models.ICustomer>;
}
export class CustomerDataService implements ICustomerDataService {
constructor(private $http: ng.IHttpService, private $q: ng.IQService) {
}
getCustomer(id: number): ng.IPromise<Models.ICustomer> {
return this.$http.get('data/Customer.json').then((response) => {
return response.data;
});
}
}
}
}
App TS
var app = angular.module('app', []);
app.value('config', new Application.ApplicationConfig());
app.service('customerDataService', ['$http', '$q', Application.Services.CustomerDataService]);
app.service('customerDataService', Application.Services.CustomerDataService);
app.controller('DefaultController', ['$scope','config', 'customerDataService', Application.Controllers.DefaultController]);
They both seem to work. Do you have to explicitly define the injections for a service?