更新时间:2022-06-18 22:10:24
在角度与您将在注射使用的名称注册为您服务。
Register your service in angular with the name that you will use in the injections.
module API.Client {
'use strict';
export class DefaultApi {
...
angular.module('yourmodule').service('TDRService', DefaultApi);
角将使用的变量名称(未的类型),所以它必须是相同的名称,因为它是在角登记。而且,您可以使用私人
在构造函数,而不是像你这样做了分配。
Angular will use the variable name (Not the type), so it has to be the same name as it was registered in angular. And, you can use private
in the constructor instead of doing the assignment like you did.
import TDRService = API.Client.TDRService;
export class ListaTrtController {
/* @ngInject */
constructor(private TDRService: TDRService) {
}