Questions tagged [angularjs-provider]

A provider is an object with a $get() method. The injector calls the $get method to create a new instance of a service. The Provider can have additional methods which would allow for configuration of the provider.

59 questions
0
votes
1 answer

AngularJS - Polluting provider, services, and factories externally

I unintentionally polluted a service with properties I thought I was assigning only to a scope. Example: var ServiceFunction = function ServiceFunction(){ this.greeting = 'Hello'; }; var TestController = function TestController(testService){ …
dewd
  • 4,380
  • 3
  • 29
  • 43
0
votes
1 answer

angularJS: Provider of app A not available in config of app B; app B is the main app attached to DOM

I have a Provider defined in an angular module say A, and I am trying to use it in the config of another angular module say B, as shown in the following code snippet: var A = (function(ng){ 'use strict'; var a =…
0
votes
2 answers

My AngularJS app doesn't run in Microsoft Edge, Unknown provider

I'm working on a web application using AngularJS. Everything seemed to work well until I tried to run it with Microsoft Edge web-browser: Error: [$injector:unpr] Unknown provider: serviceAjaxProvider <- serviceAjax <- MainCtrl I created a service,…
0
votes
1 answer

ui-router $urlRouterProvider wait until all states loaded

I'm trying to dynamically load a bunch of states, by merging them from some disperse files. I'm collecting all of them with $http.get and then add all with $stateProvider.state(name, config). All ok here. The problem is that if I enter another URL,…
MGP
  • 653
  • 1
  • 14
  • 33
0
votes
1 answer

angular provider throws error after converting to coffee script

I forked this really nice repo https://github.com/loicknuchel/ionic-starter and started to translate the app to coffee script. Almost everything worked well but with the…
0
votes
0 answers

How to make configurable directives via providers/ .config()?

Problem: I want to make a directive that works like this: svg-icon('company-logo') I'd also eventually like this to be (jade/html): svg-icon('company-logo', { height: '3em', width: '3em'}) And I…
0
votes
1 answer

Angular provider not setting value

I've made my own module, with a provider. I want other users to be able to override the default config: angular.module('mymodule').provider('mymoduleConfig', [function() { var object = { theme: 'default' }; var updated = {}; …
Alias
  • 2,983
  • 7
  • 39
  • 62
0
votes
1 answer

How to inherit from base provider (not the provider factory)?

Say I have this base provider: angular.module('app').provider('BaseClient', function () { this.setSomething = function (something) { // Store `something` somewhere return this; }; }); And now these 2 other…
rfgamaral
  • 16,546
  • 57
  • 163
  • 275
0
votes
1 answer

Can't Inject native angular services into a custom provider

I'm trying to create a provider to handle authentication in my app function Authenticator($http) { console.log($http); return { test: function() {} } } app.provider('authenticator', function…
Eduardo Leal
  • 807
  • 2
  • 9
  • 18
0
votes
1 answer

AngularJS inject $http into config for angular-translate

I'm using angular-translate module and am trying to inject all my translations that are on server with $http. I use a provider and I know that only i can inject dependencies through $get but I can't call that function from my provider. I need to…
user3461226
0
votes
1 answer

Trigger $modal.open from app.js

My app.js looks something like this. I need to handle the AJAX errors globally. This code works fine if I were to use only console.log. However, I need to trigger a modal dialog by using $modal, but not sure how to implement that. Any help is…
0
votes
0 answers

Any way to inject a provider with a dependency on another provider in AngularJS config

Given the code: angular .module('someApp', ['provider1Module, provider2Module']) .config(function (provider1ModuleProvider, provider2ModuleProvider){ provider1ModuleProvider.getSomethingSpecific() }) Given also that…
erfling
  • 384
  • 2
  • 16
0
votes
1 answer

Injecting and using a service into my provider then using the provider in the config block

I am trying to inject a custom factory from one module into a custom provider from another module. What I really want to do is to use the custom factory inside the config block but I can't, so I'm trying to configure a provider that uses the custom…
user3667725
  • 111
  • 1
  • 9
0
votes
1 answer

How to use service in config / why is provider instance injected in config?

I read about how to inject dependency in cofing method of the module. I created provider for my service like this app.provider("securitySvc", function securitySvcProvider () { this.$get = ['Authorizations', '$q', 'routeSvc', function…
epitka
  • 17,275
  • 20
  • 88
  • 141
1 2 3
4