Tagged Questions
0
votes
1answer
12 views
How to call a function on the scope from a string value
I have an object containing an array of strings
$scope.actions=[
"add_inscription",
"add_tools",
"add_instruction",
"remove_inscription",
"remove_tools",
"remove_instruction"
...
0
votes
1answer
17 views
ngTable custom refresh action?
I have a table showing data from a remote server. There is a numeric input, when the number is changed I want the table to be refreshed (with the numeric input in arg).
Here is my current attempt:
...
0
votes
0answers
7 views
Angular location change resetting browser history
I'm watching for a change on $locationChangeStart, if the user is on Step2, and they try to go to Step1 via the browser back button, I have successfully interrupted this, displayed an alert, and will ...
0
votes
2answers
28 views
AngularJS - How to load a service from other app
I have this angular code:
This is my controller:
MyApp.controller('vtCustomerController', function ($scope, messageBus, customerDetails, $http, $q) {
$scope.loadCustomerDetail = function ...
0
votes
1answer
20 views
how to return a factory object after all ajax calls are done
I have a factory which returns an object with several properties. But each property value is computed by ajax call and in some cases I do promise chaining in order to set a property value. Before I ...
0
votes
0answers
9 views
How to lazy load panel content on a button click having multiple panels on the same page using angularjs
I have a scenario here where I have multiple panels (using ng-repeat) on the same page. Each panel have a link, on click of which it loads data specific to that particular panel and returned response ...
0
votes
2answers
35 views
Unable to inject $location service
This code gives me Error: [$injector:unpr] Unknown provider: $scope, $locationProvider <- $scope, $location.
var app = angular.module('myApp.controllers', []);
app.controller('Signup', ['$scope, ...
0
votes
2answers
38 views
How do I populate a scope with a http response?
The problem I have is that on page load the response from the API takes a while and my view (scope) is empty. But when I switch view back and forth the groups-view (scope) is updated with the object ...
0
votes
3answers
29 views
Loading select options from a service in a directive before model binding angularjs
I'm trying to create a directive to load select items(from server) for the lists that I need using a Key for each list, but it seams that model is bound before the items get a chance to load, and the ...
0
votes
1answer
29 views
How to share data and calculations across multiple controllers in Angular?
This is my first project using AngularJS and, unfortunately, it isn't exactly a gentle introduction. I have had to "hit the ground running" so to speak.
I am tasked with building a customizable ...
0
votes
1answer
33 views
How to update an AngularJS service based on uploaded file?
When the browser loads my webapp, the following constant is also loaded.
var v1_module = angular.module('v1_module', []);
v1_module.constant('v1_data', {
params: [
{
name: "foo",
...
0
votes
1answer
37 views
How do I test a controller that watches for changes on an injected service?
I'm using a service to share data between controllers. If a value on the service changes, I want to update some data binding on my controllers. To do this, I'm using $scope.$watchCollection (because ...
0
votes
1answer
44 views
Why won't my AngularJS service expose it's function?
My service is:
myApp.service 'userService', [
'$http'
'$q'
'$rootScope'
'$location'
($http, $q, $rootScope, $location) ->
deferred = $q.defer()
@initialized = deferred.promise
...
0
votes
1answer
36 views
AngularJS controller scope won't sync with promise
I've picked up a project and I'm trying to return some data from a service to my controller. I've been at this for about 12 hours, and have tried different methods. They all usually result in this ...
0
votes
2answers
16 views
AngularJS data in service trigger a calculate function
I have a multi-step wizard that binds to data within a service (wizardStateSvc). I want to have a totals element on the screen that updates whenever base values for the wizard that affect the total ...
0
votes
0answers
10 views
How to test cookie Getter and Setter with Jasmine in AngularJS
I have a service with getter and setter for cookies:
angular.module('vibe.services').factory('CookieService', [function() {
var setCookie = function(cname, cval, exdays) {
exdays = ...
0
votes
0answers
40 views
AngularJs facebook login service
I am working on a simple facebook login, but I think I have a lack of knowledge about services in angular.
This is the service
// UserService
services.factory('UserService', ['$http', ...
0
votes
1answer
38 views
Angular $http.post and No 'Access-Control-Allow-Origin' header
I have two app with nodejs and angularjs.nodejs app has some code like this :
require('http').createServer(function(req, res) {
req.setEncoding('utf8');
var body = '';
var result = '';
...
0
votes
2answers
65 views
No data returned in consuming REStful web service using Angularjs
I am beginner learning Angularjs .Please help me with examples for following
script added
javascript -
var app = angular.module('myapp', []);
app.controller('MyCtrl1', ['$scope', ...
1
vote
1answer
42 views
Factory property is null when accessing directly from controller Angular
I'm trying to build simple loggin with angular and rest api and I've got strange problem with checking whether user is logged in login form controller.
Here is my code:
everytime I refresh my app it ...
0
votes
1answer
30 views
angularjs scope two values keeping pointing to each other
Hi I'm trying to copy a scope value from one to another scope. For example:
var items=$scope.order.invoicewindow.items;
$scope.order.orderwindow.items=items;
However right both scopes are ...
1
vote
2answers
67 views
AngularJS call common controller function from outside controller
My basic premise is I want to call back to the server to get the logged in user in case someone comes to the site and is still logged in. On the page I want to call this method. Since I am passing ...
0
votes
1answer
21 views
update directive from service
I would like my directive to be updated as soon as my model in the service get modified.
I can not achieve it yet:
service:
function pickerService(){
// picked elements
// do ...
0
votes
4answers
45 views
angularjs maintain the scope variable across routes
How do I maintain the model across routes. for eg I have a list of profiles loaded onto the home page. The home page also contains a "load more" action to load more profiles, basically pushing data to ...
0
votes
4answers
42 views
update a service variable within an $http callback
I'm using a service to make user data available to various controllers in my Angular app. I'm stuck trying to figure out how to use the $http service to update a variable local to the service (in my ...
0
votes
1answer
35 views
angularjs service scope issue after directive event listener callback
I am trying to use an event listener in my angular directive along with a service.
I am having a scope issue as I want 'this' to refer to my service's 'this'.
Right now, in my service, 'this' ...
0
votes
1answer
38 views
How to access Service in $httpProvider
I created a config service to provide environment specific configurations. I'm using the $httpProvider to intercept and extend the request url with a API Base Url but how do i access the config ...
0
votes
1answer
22 views
What is the proper way to create a method with a dynamic number of parameters within an angularjs service?
I'm currently using a custom AngularJS service to enable calling remote methods on my server-side. The wrapper service is intended to simplify calling these methods in my controllers, and returns a ...
0
votes
1answer
46 views
updating controller over service not updating view
in my app I have an "Maps" to show and handle things on maps. A CtrlMap controller display the map and shows an marker. The watchPosMap watches position changes. 3rd there is an service called ...
0
votes
0answers
24 views
Creating a service with $resource as a class
I have an AngularJS service to communicate about things with my REST API.
services = angular.module 'MyApp.services'
services.factory 'Things', ['$resource',
($resource) ->
r = $resource ...
0
votes
1answer
20 views
AngularJS: Way to define a large $watchCollection?
This post is not the same as: Is there a tidy way to define a large watch collection for AngularJS?
My code is (service.js):
var MyJSON = {
array: [
{k:'v'},
{k:'v'},
...
1
vote
1answer
34 views
What is the difference between Class actions and Instance actions in AngularJs?
From the docs:
Class actions return empty instance (with additional properties
below). Instance actions return promise of the action
The documentations however doesn't clearly differentiate ...
-1
votes
1answer
27 views
AngularJs: $resource: Unexpected behaviour while using $query action method
I am trying to fetch data using query action method from a restful service using Angular $resource
When I use the default query method as MyService.query(); I have received the following error:
...
0
votes
2answers
23 views
angularjs: Customizing resource
I am following https://github.com/StarterSquad/startersquad.github.com/tree/master/examples/angularjs-requirejs-2 folder structure in my app
inside services i have added following code
...
0
votes
0answers
28 views
Why do we need Angular $resource “get” and “not-get” actions?
AngularJS documentation (https://docs.angularjs.org/api/ngResource/service/$resource) states that:
**The action methods on the class object or instance object can be invoked with the following ...
1
vote
0answers
18 views
Restangular update call when options change
My services.js
angular.module('myApp.services', []).
factory('MyApi', function (Restangular) {
var options = {quran: 210, content: 217, audio: 1};
var callBack = 1;
return {
...
1
vote
2answers
68 views
Angularjs: Singleton service using $http [closed]
is it possible in angular to create service using $http which will take method, url, success and failure callback as parameters when called from controller.
I want to achieve following kind of ...
0
votes
1answer
18 views
Angular provider not loading
i'm having some issues loading my providers.
setup is as follows:
ng-view with main.html
main.html has controller MainCtrl
I have several directives which need access to the same data, so i'm using ...
0
votes
1answer
60 views
Inserting a directive from another directive's compile function
I want to dynamically insert the <confirmation> element in the DOM from the updater directive. (I have it setup to tap into an event, which it does in my real app) I just need that element ...
0
votes
2answers
56 views
AngularJS for loop not waiting for modifications to $scope
I've been wracking my brain over this for a few days, so I figured it's time to finally ask somebody who actually knows what they're doing. ;)
I'm building an AngularJS app and getting an odd ...
0
votes
1answer
16 views
AngularJS: function always evaluates to false because of Async nature of service
My Template looks like
<div data-ng-if="budgetSummaryExists()">
<span>You have not budget</span>
<button type="button" class="btn btn-danger"
...
0
votes
1answer
40 views
How does $injector service inject itself in AngularJS
An AngularJS app depend on the $injector service to inject other built-in or customize services in controller,directive or other injectable things, but how $injector service inject itself,just like : ...
1
vote
2answers
35 views
AngularJS: Recommendation on rendering different view when HTTP 404
What I am doing
I am trying to create a service which loads the user budgets for current month. The code looks like
$scope.thisMonthBudgetSummary = function () {
console.log('retrieving ...
0
votes
1answer
42 views
How to inject my service into my controller angular js
I am relatively new to angular JS and I have an issue with angularJS 1.3.0 beta build
I am trying to insert my service (a standalone module) to a controller.
This is my app Code
'use strict';
...
0
votes
3answers
88 views
Getting “Unknown Provider” while injecting service into controller
I have my App:
'use strict';
angular.module('ProjectTracker', [
'App.controllers',
'App.services'
])
My Service:
angular.module("App.services", [])
.factory('ProjectManager', function () {
...
0
votes
0answers
41 views
angularjs on loadmore append to existing model using ng-repeat by caling a service
I have a profile page where in the model is loaded by a call made through a service via php that returns profiles, on click of load more how do I push data to the existing model and update the data.
...
0
votes
1answer
29 views
AngularJS View Not Updating Using Defer and Factory
I am currently having an issue where when I try to create a new setting my view is not being updated until I refresh the page. Can anyone point me into the right direction? If I am going about this ...
0
votes
1answer
25 views
constructor injection in angularjs
what is the correct way to do constructor injection in angularjs for instantiating objects with a factory or a service and invoke in a controller?
Ref : http://docs.angularjs.org/guide/providers
If ...
0
votes
2answers
47 views
angularjs - constructor injection with arguments
I'm trying to instantiate an object using the angular.factory recipe. The factory code is something like this
monevAppServices.factory('MonEvChartService', ['element','chartConfig',function ...
1
vote
1answer
41 views
With $http.post in algularJS how can I pass more than one parameters
I am trying to do a post request to save data in the server using the following url:
url = /api/projects/:projectId/scenarios/:scenarioId
I want to pass projectId and scenarioId. How can I do that ...