Tagged Questions
0
votes
1answer
43 views
AngularJS: Watch Service Property Changes
I'm trying to show a simple download progress for my app. Every time a file has downloaded the total number os downloads is presented to the user. For example, File 1/5, 2/5, 5/5.
The download is ...
0
votes
0answers
50 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);
...
0
votes
2answers
73 views
How to fill variable with values by service (AngularJS)
My variable has no value after calling the service. I defined the success function as a separate function and called it in the .then() method, here's the code:
// Code inside the Ctrl:
var ...
0
votes
0answers
71 views
While Creating $mdToast Service, function not calling
Creating the custom service, in that using $mdToast.show() method to display the toast message. This service is injected in another controller and calling this service function from that controller. ...
0
votes
1answer
82 views
How to access objects returned by a service from within controllers
I have a service that returned array of objects to a controller , the console
showing the below response :
Array[0]
0
:
Object
first_name
:
"Emi"
id
:
"255860959988416847"
last_name
:
"Hauritz Seino"...
1
vote
2answers
831 views
What is the best way to store key value pairs in Angular JS
I have an angular app that consists of a main page and partial pages. Partial pages are displayed in ui-view
<div class="" ui-view>
</div>
To store a global variable I use $scope.$...
0
votes
1answer
40 views
Pass Data to Service from Controller AFTER receiving info from Server
I need to pass data to an array in service after getting from server. The controller runs the function to retrieve data as shown
.controller("messagesController", function($scope, $stateParams, ...
2
votes
1answer
4k views
How to share variables across components in Ionic 2?
In Ionic 1 (With Angular 1), I can create a $scope.abc on the ngApp layer and other ngControllers can inherit $scope.abc with ngModel, so that when a text area in one controller changes, the others ...
0
votes
4answers
255 views
AngularJS, how do I use a service to capture HTTP data and bind it to my controller?
I have an API call that's working great, but I'd like to use it on several controllers so I moved it to it's own service. I'm running into what looks like a classic Scope issue or a misunderstanding ...
1
vote
2answers
327 views
AngularJS - Data is not populating in table while using http service
I have a Web API which retrieves list of employees. Now when I call to $http service, I can get data from WebApi but it neither populated in table nor gives any error.
Note: I am using angular v1.5....
0
votes
4answers
157 views
angular.js:12520Error: [$injector:unpr]
i am new to angularjs, i am working on a application which uses token based authentication process, i have created a authentication service through which i get the token but when i use this service in ...
1
vote
1answer
685 views
search not working in angular data
I want to format the date and then search from the input box. I am trying to use a converter but for some reason the search does not work and my filter isnt working either
here is my fiddle example
...
-1
votes
4answers
518 views
service is not working in a simple controller
I have this js code
var app = angular.module('app', []);
app.service('testService', function(){
this.sayHello= function(text){
return "Service says \"Hello " + text + "\"";
};
this....
0
votes
1answer
72 views
Angular, 2 JSON endpoints loaded, 1 ng-repeat. How to replace 1 within the other?
I have 2 endpoints (which I do not think they are related) from jpholder:
jpholder/tds
jpholder/us
2
votes
1answer
832 views
What is best practice/alternative to use $broadcast/$on in triggering events in angularjs?
I have scenario where I want to communicate between sibling controllers in different apps. So I created sample demo which uses publisher-subscriber service to broadcast and listen event. But the code ...
1
vote
0answers
54 views
Enable service watching while the data changes between controller and directive
I'm trying to toggle a class by setting a Boolean value with ng-class. Now while using a custom directive while clicking outside of my focusing element needs to change the Boolean to false.
app....
1
vote
2answers
510 views
sharing data between controllers in two different ng-app not working via shared service
So I have two different html pages, two different ng-apps and two controllers. I am trying to share data between controllers and different modules.
Below is the basic structure of the application
...
0
votes
2answers
2k views
AngularJS bind variable from service to controller
Can I bind only variable (not object) from service to controller?
For bind object, it works (from this answer):
<div ng-controller="myCtrl1">
1st Controller
<input type="text" ng-model=...
0
votes
2answers
350 views
Getting data and passing it to another state with ui-router in AngularJS
I know the topic of passing data between controllers has been discussed here, but I've been a bit confused about what seems like a common problem and I was wondering if anyone had a 'best practice' ...
0
votes
1answer
20 views
need to find out the source of angularjs factory values modifier
In my angularjs application, I am using factory to store the values and share them across the controllers. But I am getting into a peculiar problem.
The following is my factory :
factory....
0
votes
1answer
744 views
$http POST request response returning a JSON object in service, but when called in the Controller it is undefined
So pretty much I have a service that contains functions for making some REST method calls via the $http service in AngularJS. These methods are then being accessed and called in the Controller.
...
1
vote
2answers
44 views
Issue with angular factory service
I'm trying to get my head round Angular services. I've created a simple example but when I try to utilize the service the console spits out an error (see below)
app.js
var myApp = angular.module('...
4
votes
4answers
90 views
AngularJS - controller and factory - where am I going wrong at include/inject functions?
I'm new to Angular and cannot pinpoint where I am going wrong. I'm just trying to simply inject my factory into my controller, reference said: "Cannot read property 'validar' of undefined". I have two ...
0
votes
1answer
119 views
Capture value whenever is-open (view) is changed in angular controllers
view.html
<uib-accordion-group heading="Header" is-open="$parent.accordionOpen" ng-click="headerClick()">
app.js
myApp.controller('Controller', ['$scope', function($scope) {
$scope....
0
votes
1answer
105 views
factory/service data being overwritten by next call to API endpoint
Im having issues with populating 2 highcharts graphs on a single page using a factory or service endpoint to grab my data automatically. Ive setup a directive which is working fine, i can see the ...
3
votes
2answers
111 views
Angular: Automatically update a scope reference to an object defined in a service?
I have an angular app myAppwith a service myService, holding an object datathat is used by two Controllers, parentCtrl and childCtrl the latter inheriting from the former: https://jsfiddle.net/OleWahn/...
0
votes
1answer
35 views
Shoud $watch work if I change variable on $broadcast
I broadcast undo-redo-changed event from my service and handle in scope.on but $watch funciton don't called. Why? Is it correct way to use $watch? The porpose of these code to change button state when ...
1
vote
2answers
499 views
Unable to set the http defaults inside the angularjs factory
In my Angularjs application, I have a factory and I need to authenticate a user. I am using the httpProvider to set the defaults. But I am getting the error stating $httpProvider is not defined.
'use ...
0
votes
3answers
299 views
angularjs: injecting async service into directive with $resource
I'm very much trying to get my head around angularJS and directives still.
I have an existing REST service that outputs JSON data as follows (formatted for readability):
{"ApplicationType":
["...
3
votes
6answers
7k views
AngularJs: pass $scope variable with service
I have two controllers and in one of them I declared a $scope variable that I would like visible in the second controller.
First controller
app.controller('Ctrl1', function ($scope) {
$scope....
1
vote
1answer
32 views
Angular js service value does not updates in the view
I'm using the stateProvider, and when the state is changed i want to update my breadcrumbs in the header. Instead of writing for each state its own embedded view, i just put on the service that shares ...
2
votes
1answer
77 views
Nested ng-repeat to repeat on parent repeats ID
I am trying to perform a nest ng-repeat (using ng-repeat-start and ng-repeat-end).
The first repeat displays a list of locations as well as an associated id. For example:
Mauritius | ID: po8j3mau72
...
0
votes
1answer
602 views
Calling multiple REST APIs using response of first API in AngularJS
I am new to AngularJS and trying to make an application which loads data by calling APIs. It is like I am fetching the list of boxes of type A (Resource Groups) and then each Box of type A has ...
0
votes
2answers
302 views
How to access variables in angularjs $http service
I have my controller and it fetches data from 2 json files using $http service.
This data is stored inside $scope variables like $scope.name and $scope.application.
But I am unable to parse over both ...
0
votes
1answer
61 views
directive unable to retrieve data from a service
I have a little SPA using angular. The concept is simple, after login, $routeProvider redirects to a home page where I have a homeController specified.
this is from my home view that is rendered by ng-...
1
vote
2answers
384 views
When and where to use multiple controllers/directives/services/factories in angularjs?
I am very new to angularJs.I understood the some concepts but still a lot of things are not clear.I am looking for your help to understand me the following scenarios with some demonstration for clear ...
0
votes
2answers
138 views
No-JavaScript or no-cookies-enabled browser
Assume that a user has JavaScript or cookies turned off in the mobile/desktop browser. Now, when a user comes to the site, the user should be re-directed to a specific page (e.g. some error page). How ...
-1
votes
1answer
2k views
Linking one controller to another to call service on ng-click
I have two templates with respective controllers and service files. One template's(fleetListTemplate) controller(fleetListController) loads data from its service file(fleetService) and displays in ...
-1
votes
2answers
40 views
Error: [ng:areq] Argument 'ext-modules/fleet/jsFleetController.js' is not a function, got undefined
am getting "Error: [ng:areq] Argument 'ext-modules/fleet/jsFleetController.js' is not a function, got undefined" this error message when ever I load the template file.
The following are the code, ...
0
votes
1answer
628 views
Calling service.js file from controller
I have a service file which needs to be called from the controller. Can someone please tell the code which should go in the controller to get this service file. Thank you.
This is my service file ...
0
votes
2answers
60 views
Can anyone explain the core concept of model in angularjs?
HTML Code:
<mydirective></mydirective>
<input type="button" ng-click="showText()" value="Show Service Text" />
Js Code:
var app = angular.module('demo', []);
app.service(...
1
vote
2answers
395 views
Argument 'AppCtrl' is not a function, got undefined, can't seem to fix
This is my angularApp.js:
var app = angular.module('intuo', ['ui.router','ngMaterial', 'ngAnimate']);
app.config(['$stateProvider', '$urlRouterProvider',
function($stateProvider, $urlRouterProvider) ...
0
votes
1answer
129 views
how to load more than one service in $state resolve?
I want to load two APIs before page is going to load For it i have used the following code in $stateProvider
.state('admin-panel.default.jobadd', {
url: '/jobadd/:jobID',
templateUrl: 'app/...
0
votes
2answers
49 views
how to use outer variable in angularjs directive?
I want to change ng-model(degree) value to id(degree_id) in my template as following
<md-select flex class="md-select-form" ng-model="education.degree" placeholder="Degree" save-id required-param="...
0
votes
2answers
819 views
Angularjs service method not getting called, TypeError: Cannot read property '
I am new to angularJs.
I am havin problem in calling a method from service.
Here is my controller (app.js)
angular.module('starter', ['ionic','ngCordova','NameService'])
.run(function($...
0
votes
3answers
48 views
How to simplify this switch statement (Angular app)
I'm using a modalService to store modal templates in my mainController.
Here is how I store them (from mainController)
// Store popup modal:
$ionicModal.fromTemplateUrl('app/popup/popup.html', {})
....
0
votes
1answer
45 views
setting the scope elements after the http call in angularjs
I am new to AngularJs. I am calling a http get call to fetch a list of names and I want it as soon as the app loads. Hence I have written the logic to get the list of names in the run function on ...
0
votes
1answer
1k views
How to use variable from a Controller in a Directive link function?
I want to be able to use the variable "videoUrlId" from the controller 'useSpreadsheetData' below in my directive 'meetings'. How can I do this? I have looked at require but could not get it to work.
...
0
votes
1answer
28 views
Angular - Template not refreshed with data bound from two different scopes to the same service
I bind data of two different scopes to the same common service data. When I update the data through controller 1, the data in controller 2 is not refreshed in template.
Example showing the issue :
&...
4
votes
1answer
223 views
AngularJS: Bind a directive to a Controller via a Service update
How to bind a directive to a controller via a service update ?
I want to create the possibility to update a cart(the service) via a directive(add to cart button) and then the controller (that display ...