Подтвердить что ты не робот

Ошибка: [$ injector: unpr] Неизвестный поставщик: $stateProvider <- $state

Выполнение ниже unit test дает "Ошибка: [$ injector: unpr] Неизвестный поставщик: $stateProvider < - $state". Я добавил файл angular -ui-router.min.js в файл кармы.

 describe("Unit tests", function() {

  var $rootScope, $injector, $state;
  console.log("hello");

  beforeEach(inject(function(_$rootScope_, _$state_, _$injector_, $templateCache) {
    console.log("hello1");
    $rootScope = _$rootScope_;
    $injector = _$injector_;
    $state = _$state_;
  }));

  describe("states", function() {
    it("verify state configuration", function() {
        var config = $state.get("DRaaS");
        console.log(config, "cc");
    });
  });
});
4b9b3361

Ответ 1

Вы не загрузили какой-либо модуль, поэтому никакой сервис вообще не доступен. Добавьте это перед вашим перед каждым:

beforeEach(module('ui.router'));