未捕获错误:[$injector:unpr]在AngularJS中

未捕获错误:[$injector:unpr]在AngularJS中,angularjs,Angularjs,在我的项目中,我正在尝试将AngularJS版本从1.3升级到1.7。作为升级的一部分,我已将现有库升级到AngularJS 1.7的相应兼容版本。但是,我在控制台中从angular.js文件中得到以下错误。你知道我哪里会出错吗 angular.js:26037未捕获错误:[$injector:unpr] platform.systeminformationwarningservice是我的应用程序中的一个文件,定义为: (function () { 'use strict'; ang

在我的项目中,我正在尝试将AngularJS版本从1.3升级到1.7。作为升级的一部分,我已将现有库升级到AngularJS 1.7的相应兼容版本。但是,我在控制台中从angular.js文件中得到以下错误。你知道我哪里会出错吗

angular.js:26037未捕获错误:[$injector:unpr]

platform.systeminformationwarningservice
是我的应用程序中的一个文件,定义为:

(function () {
  'use strict';

  angular
  .module('platform')
  .service('platform.systemInformationWarningsService', systemInformationWarningsService);

  systemInformationWarningsService.$inject = ['$rootScope', '$interval', 'ifesModal', 'api', 'platform.ifesSecurity'];

  function systemInformationWarningsService($rootScope, $interval, ifesModal, api, ifesSecurity) {

    var warningsService = getWarningsService();
    var translations = Ifes.Assets.WebUI.Areas.Platform.Views.SystemInformation.SystemInformation();

    var service = {
      init: init,
      subscribe: undefined,
      unsubscribe: undefined
    };

    function init() {
      ifesSecurity.hasFunctionPermission('Core.SystemInformation.View').then(startScheduler);

      function startScheduler() {
        $interval(checkWarnings, 300000);
      }
    }

    function checkWarnings() {
      warningsService.getWarnings().$promise.then(success);

      function success(result) {

        if (result === undefined) {
          return;
        }

        var text = "";
        var previousWarnings = JSON.parse(localStorage.getItem("previousWarnings"));

        angular.forEach(result, function (warning) {
          var found = (previousWarnings !== null && previousWarnings.some(function(id) {
            return id === warning.Id;
          }));

          if (!found) {
            if (previousWarnings === null) {
              previousWarnings = [];
            }

            previousWarnings.push(warning.Id);

            if (text !== "") {
              text += "\r\n\r\n";
            }

            text += warning.Title + ":\r\n" + warning.Text;
          }
        });

        if (text !== "") {
          showWarning(text);
        }

        localStorage.setItem("previousWarnings", JSON.stringify(previousWarnings));
      }
    }

    function showWarning(text) {
      var modalOptions = {
        scope: $rootScope
      };

      $rootScope.alertHeader = translations.SystemInformationLabel;
      $rootScope.alertMessage = text;
      $rootScope.alertType = "warning";

      ifesModal.alert.open(modalOptions);
    }

    function getWarningsService() {
      return api('User/SystemInformation/:id', { id: '@Id' }, {
        getWarnings: { method: 'GET', url: 'User/SystemInformation/Warnings/Current', isArray: true }
      });
    }

    return service;
  }
})();

我在这里读到,依赖关系可能没有正确定义,但我不认为这是这里的问题。

也许这里有问题

systemInformationWarningsService.$inject = ['$rootScope', '$interval', 'ifesModal', 'api', 'platform.ifesSecurity'];

function systemInformationWarningsService($rootScope, $interval, ifesModal, api, ifesSecurity) {

您已经添加了
平台。如果您使用的是最新版本的AngularUI引导,则代码需要在
$uibModal
中插入
$inject
而不是
$modal
,而不是
$modal

,因为所有引导指令和服务名称现在都以
$uib
前缀作为前缀

$modalInstance
依赖关系也会发生同样的情况,需要将其更改为
$uibModalInstance

有关详细信息,请参阅

systemInformationWarningsService.$inject = ['$rootScope', '$interval', 'ifesModal', 'api', 'platform.ifesSecurity'];

function systemInformationWarningsService($rootScope, $interval, ifesModal, api, ifesSecurity) {