There is a factory :

 'use strict'; var coreModule = angular.module('core.vkApi', []); coreModule.factory('VkFactory', ['$window', $window => angular.isDefined($window.VK) ? $window.VK : null]); 

And provider :

 'use strict'; var coreModule = angular.module('core.vkApi', []); coreModule.provider('VkApi', function VkApiProvider() { var settings = {}; this.setSettings = function(vkSettings) { settings = vkSettings; }; this.$get = ['VkFactory', function(VkFactory) { ... }]; }); 

When I try to use VkApiProvider, I get this:

Unknown provider: VkFactoryProvider <- VkFactory <- VkApi <- SocialNetworksManagerService <- VkApi

The question is - what is VkFactoryProvider? I don't have such a provider, I don't use it anywhere. How to force angular to use factory without trying to contact the provider?

    1 answer 1

    The problem is that the module is recreated here.

     var coreModule = angular.module('core.vkApi', []); 

    And in the new module, of course, there is no factory.

    In this case, you need to get the module, for this you need to remove the second parameter, in which dependencies are transmitted

     var coreModule = angular.module('core.vkApi'); 

    Link to the appropriate help section

    • Thanks again for the help, the problem was really that. - Ilya Bizunov