Tagged Questions
-3
votes
0answers
24 views
how to pass json object between different controllers in angular js? [duplicate]
Like in asp.net mvc, we use ViewBag, ViewData, to pass in objects between different views. How do i pass in a Json Object between 2 different controllers using angular js?
0
votes
1answer
23 views
How to bind to the result of a function in AngularJS
I have an array of items that I want to keep track of across several controllers. So, to do this, I made a service.
The service is basic for now, just adding items to an array and the ability to get ...
0
votes
2answers
55 views
How to get a $scope object to an angular service
I have an object that I am modifying on $rootScope where I am "storing" my last search parameters. Currently I have the values returnType, rows, and query hard coded. I would like to those just be ...
2
votes
2answers
35 views
AngularJS - Design pattern for returning a subset of data from a service… and binding to the set?
I have a service that manages a set of data. The service is polite enough to provide options to return a subset of said data based on (whatever logic, in this example it's simply going to look for a ...
0
votes
1answer
30 views
How do I use a legacy javascript library as a scoped dependency of an Angular service?
Specifically, I am working with an ~800 line SCORM API wrapper library that facilitates communication with an LMS. The author did not write it in Angular. A legacy, vanilla js file(index.js) has been ...
0
votes
0answers
23 views
getting : undefined is not a function on getting collection from web-api
I have a web api which returns IHttpActionResult(myCollection) on Get.
My angular JS controller is has a function :
$scope.loadcollection = function($defer, params) {
console.log("inside ...
0
votes
2answers
22 views
In angularJS store the admin(id, password) by start from a json in localstorage, but angularJS didn't work
I want in angularJS store oder preload the admin(id, password) by start from a json in localstorage, but angularJS return always error. the init function I have written through a ...
0
votes
2answers
43 views
Convert String to Function in AngularJS
I am trying to convert strings to AngularJS Service method calls in a controller. For example, I would like to convert the string "Contact.send(email)" to call an existing service method. I thought ...
0
votes
2answers
22 views
calling ng-view controller method from outside controller?
HTML:
<html ng-app="san">
<head>
</head>
<body ng-controller="sanctrl">
<div>
AngularJS</div>
<div ng-view="">
</div>
<button type="button" ...
0
votes
2answers
32 views
Can't bind 2 objects from JSON in Angularjs?
I'm new to Angularjs. I am learning about factory.
In my example, I have 2 requests to Restful Api and got 2 responses in JSON format.
With the first json, I can use ng-repeat to show them but the ...
0
votes
1answer
45 views
Service not working - AngularJS
My task is to create a form and display the entered data to a div on clicking 'Submit'. The task involves creating two directives, one for creating the form and another for displaying the entered ...
0
votes
1answer
34 views
How to $http.post with payload in data?
How do I post data from a form in AngularJS?
<form data-ng-submit="doSomething()">
<input type="text" data-ng-input="do_obj.text"/>
<input type="email" ...
0
votes
0answers
31 views
How to modify the scope in an event in a service (factory)?
I created a factory that creates an audio tag with different audio files played.
What I want to do, is to make a loading gif appears while it load a new audio file, then disappear when it is loaded.
...
-1
votes
1answer
26 views
Why AngularJS services get undefined while navigation from one route to the other?
I have an issue in AngularJS. I am trying to authenticate the user and when a response got back from the server I use a service to store the user state as he is admin or not. Till now everything is ...
1
vote
0answers
43 views
How to prevent calling of a service when hitting refresh button
I have problem in angular. I have made a service that should authenticate the user that service has two variables which are var isAuth and var IsAdmin;which indicates the state of the user.
In the ...
0
votes
1answer
30 views
Trying to call method in service from a controller
I'm trying to call a method in a service from a controller and am receiving the error: 'TypeError: undefined is not a function'. Does anyone see anything wrong with how I have things set up?
valid.js
...
0
votes
1answer
48 views
Update AngularJS Controller Scope from Another Controller/Scope
Hopefully this hasn't been asked.. I looked around and haven't found anything yet.
I have a single view that provides the user with a modal dialog (wizard) to create a few things and then save them. ...
0
votes
0answers
69 views
Angularjs Service Scope + Bindings
I am looking to run the following controller but im having trouble with scope.
I have a service that calls two functions that retrieve meta data to populate scope variables.
The issue is that ...
0
votes
2answers
37 views
Accessing $scope properties from inside a service in AngularJS
I am trying to create a constructor function inside an angular service, which I could then use inside of my different angular controllers. The problem is, my object generated from the constructor ...
2
votes
1answer
45 views
AngularJS: What is this directive doing?
I have a some experience with AngularJS and have come across this directive on the web, but it is not like anything I have seen before and I am unable to comprehend what it is doing? Can anyone help?
...
0
votes
0answers
30 views
Share data between directives
I'm rendering a large form that is described in a json file, in my view I'm using ng-repeat and then sending each element to a 'master' directive called FormRender, I have a controller in this ...
0
votes
1answer
14 views
Angularjs Error: registerService.getRegisterResponse is not a function
Error: registerService.getRegisterResponse is not a function
I getting Above Error on console of the web browser. While Accessing the a method(i.e saveRegisterResponse()) from Controller (i.e ...
1
vote
1answer
59 views
Getting variable from socket.io in AngularJS
Basically i have two sources of data, one is real time data from socket.io and other is json object. And i'm using both in front-end but the problem is that i need to pass a variable from socket.io to ...
0
votes
1answer
41 views
Directive with isolate scope property on ngSelect element to pre-select option: It randomly loses value
It looks like this. I load my page and my form displays with values fetched. These values are being fetched by an http service. At the top of the form there is my custom directive (select box):
...
0
votes
0answers
58 views
Workout on restful services for single page applications
I am just a beginner in Angularjs. I have been trying for consuming WebApi service by angularjs. I am following this
1: ...
1
vote
1answer
99 views
What is the difference between `value` attribute and `ng-value` attributes in angularjs
What is the difference between value and ng-value attributes in angularjs templates? If I use ng-if on the field using value attribute it works properly but if I change the attribute value to ng-value ...
1
vote
1answer
60 views
How to add dynamic fields with angularjs
I am working on a QA app where i need to add multiple answers to a question as per requirement dynamically. for this in my form I have a question field , an answer field and a Boolean correct field to ...
0
votes
0answers
65 views
How to handle many to many relationships with Angularjs' $scope variable
I have two services that hold my two objects which have a many to many relationship; Missions (or steps/actions) and the Tools needed for these Missions. Each Mission can use many tools and each Tool ...
0
votes
1answer
204 views
Angularjs select with ng-options calling a function?
here is my html
<select ng-model="selectedMarker" ng-options="shape.text for shape in Selects('shapes')">
</select>
and the code
angular.module('todo', ['ionic'])
...
0
votes
2answers
70 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
25 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
0answers
34 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
44 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
1answer
41 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
189 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
1answer
37 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 ...
0
votes
4answers
220 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
1answer
73 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
68 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
73 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
31 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"
...
1
vote
2answers
60 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
36 views
How to check for errors in resolve using angularjs?
Im using a resolve in ui-router and a promise in my controller, but cant figure out how to check if a 422 / 500 error is returned and show a different message.
here is my code:
.state('rated', {
...
0
votes
0answers
34 views
AngularJS remembering page scroll location
I have multiple pages of data that lists publications by author. The first page lists all the publications and has infinity-scrolling implemented.
Another page allows you to filter by author, and ...
0
votes
1answer
247 views
angularjs - Watching service properties in a controller scope… changing them from a directive… no update?
Let's say I have a very simple service with a few properties on it. If I use the service in a controller, put the service's properties on the scope so that they are bound to my view, and update them ...
0
votes
2answers
192 views
AngularJs ngShow triggers double in controller
I have a problem with the controller triggering the method defined on the $scope twice when the page first loads and when the form submits.
Here's the fiddle : http://jsfiddle.net/scabro/pQb6q/5/
...
0
votes
1answer
255 views
How can I download a file using AngularJS?
I want to list all the files(from a directory) in the view. When I click anyone of them. Then the corresponding file must be downloaded.
Note: I am working in a windows machine.
I have the following ...
0
votes
1answer
287 views
AngularJS - mechanics of $scope.$watch - is it just an observer pattern?
I have some factory:
.factory("someFactory", function() {
var someFactory = {};
someFactory.objects = [
{ name: "obj1" },
{ name: "obj2" }
];
return someFactory;
}
And some ...
0
votes
4answers
303 views
How to display JSON list data in angularjs
I am new to Angularjs and having trouble displaying data . i.e. Json array
This is the result of my rest service call:
...
0
votes
0answers
16 views
Is service dependency mandator if implementation enviroment contains the dependency (I.E controller has dependency)
Is a dependency added to service when it will be used in a controller with the dependency already injected.
The service :
myServices.factory('firebaseWritejournalUser',['',function() {
...