62 questions
1
vote
0
answers
31
views
AngularJs - How to update Internal data within a Factory?
I have a factory in my app which takes environment uri data as input parameter and returns a $resource object as below. The coreService is a singleton object used in many other controllers of UI. ...
0
votes
1
answer
83
views
how to create different versions of a service using angularjs providers
I have a function called itemService.. gets item from shoppingList controller and push it into items array then return this array back.
now i need to create 2 shoppingLists so using .factory i manged ...
1
vote
0
answers
163
views
Angular JS: Unknown provider: $mdThemingProviderProvider <- $mdThemingProvider
When the High Contrast Mode is on, I need to use the dark theme and is working as below:
$mdThemingProvider.theme('default')
.primaryPalette('green')
.accentPalette('orange', {...
0
votes
1
answer
55
views
Failed to instantiate module in AngularJS due to missing (loaded) provider
Working on an old project using AngularJS, and seem to be getting the good old "Failed to instantiate module" error due to "Unknown provider", but the funny thing is that the module that provides this ...
0
votes
0
answers
77
views
AngularJS advice on converting Factory to Provider?
I need to inject content from a Factory into a Config but I know this isn't possible and is only possible if I use a provider instead, so please can anyone advise how to convert my factory into a ...
1
vote
0
answers
49
views
Use service as provider in config but also as service in controller
So I have this service :
var module = angular.module('app.shared.user', []);
module.service('userService', ['$q', '$http', 'firebaseService', function($q, $http, firebaseService) {
this.isAdmin ...
0
votes
0
answers
65
views
Why does running this AngularJS code locally work, but not on IIS?
I have a settings provider that runs fine on localhost, but doesn't work on IIS. The error from AngularJS is:
[$injector:modulerr] Failed to instantiate module app due to:
Error: [$injector:unpr] ...
0
votes
1
answer
171
views
AngularJS unknown provider after code refactoring
I have an app which worked great, until I decided to refactor the code and use Gulp for my project. Here is the error I get:
Error: [$injector:unpr] Unknown provider: _Provider <- _ <- ...
3
votes
1
answer
331
views
Create unique instance of provider ionic 3
I am creating an Ionic app. I have 3 providers - database provider, portfolio provider and user provider. All 3 are Injectable. I have created it this way because several other pages need to use their ...
0
votes
2
answers
403
views
Run a function before running a controller
I have defined a factory auth as follows:
app.factory('auth', [function () {
var auth = {};
auth.getUser = function () {
... ...
// get user from cookie, cache, history, etc.
...
0
votes
1
answer
225
views
typescript not recognizing the interface on angularjs providers $get method
OK, so I wanted to have a provider which would allow me to closure the reference for the state provider. So, I've got the JS code and I'm trying to migrate it to TS. This is what I've got so far, ...
1
vote
1
answer
482
views
Using $sceProvider functionality from $sce
From Angular documents it says that $sceDelegateProvider.resourceUrlWhitelist can set the trusted resource URLs, But I need that functionality from the controller.
I want to set a whitelist of ...
1
vote
1
answer
71
views
JavaScript- calling a function defined inside a provider
I have recently taken on the development of web app that has been written in AngularJS. In one of the files, myApp.js, there is a provider that is defined as follows:
.provider('myAppConf', function($...
0
votes
0
answers
276
views
Angular + response headers - can´t access response headers from $http provider
I've tried to access response headers through $http provider without success. In my research I read that it's a CORS issue. But that doesn't make any sense because reading the headers in GoogleChrome ...
0
votes
0
answers
71
views
AngularJS service cannot access its own functions when used through provider
Here's my provider:
class testPr {
....
/** @ngInject */
$get($rootScope, $timeout, $window, FacebookService) {
const _this = this;
this.sdkInit($rootScope, $timeout, $window);
...