main module
导入commonServices module
和caseinfo module
,caseinfo module
声明recordsComponent
。
commonServices module
使用EzursMedicalRecords
声明两个服务DocumentPreviewService
和.service
。
recordsComponent
注入EzursMedicalRecordsService
,EzursMedicalRecordsService
注入DocumentPreviewService
我已经检查了所有内容:
.service
声明一次$scope
这是物品的声明方式
common-services.module
export default angular.module('app.common-services', [
angularLocalStorageModule,
ngSanitizeModule,
uiSelectModule,
ngIdleModule,
angularLoadingBarModule,
angularValidationMatchDirective,
uibTypeaheadModule,
angularRecaptcha,
signalrModule
])
.service('documentPreviewService ', documentPreviewService )
.service('windowEventsService', windowEventsService)
.service('ezursMedicalRecordsService', ezursMedicalRecordsService)
.service('blobService', BlobService)
caseinfo模块
export default angular.module('app.caseinfo', [uirouter, uibAccordionModule, uibTabsnModule, "kendo.directives"])
.controller('RecordsController', RecordsController)
主模块
import caseInfoModule from './case-info-page';
import commonServicesModule from '../common/services/app.common.services';
angular
.module('app', [
caseInfoModule,
commonServicesModule,
])
有组件
class RecordsController {
constructor(urls, $http, ezursGridService, blobService, ezursMedicalRecordsService, dialogService) {
this.urls = urls;
this.$http = $http;
this.ezursGridService = ezursGridService;
this.blobService = blobService;
this.ezursMedicalRecordsService = ezursMedicalRecordsService;
this.dialogService = dialogService;
}
RecordsController.$inject = ['urls', '$http', 'ezursGridService', 'blobService', 'ezursMedicalRecordsService', 'dialogService'];
export default {
bindings: {
caseDto:"="
},
template,
controller: RecordsController
};
ezursMedicalRecordsService
class MedicalRecordsService {
constructor($http, urls, blobService, $window, documentPreviewService) {
this.$http = $http;
this.urls = urls;
this.blobService = blobService;
this.$window = $window;
this.documentPreviewService = documentPreviewService;
}
MedicalRecordsService.$inject = ['$http', 'urls', 'blobService', '$window', 'documentPreviewService'];
export default MedicalRecordsService;
和documentPreviewService
class DocumentPreviewService {
constructor($http, urls) {
this.$http = $http;
this.urls = urls;
}
}
DocumentPreviewService.$inject = ['$http', 'urls'];
export default DocumentPreviewService;
我确实需要将documentPreviewService
注入整个应用程序中使用的ezursMedicalRecordsService
中。
我不明白为什么可以将documentPreviewService注入ezursMedicalService。我有blob.service,它的声明方式与documentPreviewService相同,但是blob.service都可以。
答案 0 :(得分:2)
在服务声明中,documentPreviewService后面有一个空白:
.service('documentPreviewService ', documentPreviewService )
我以为删除它可以解决问题!