0
votes
3answers
23 views

How to access an object attribute inside a service in AngularJS?

I have a service with a local variable object with events names: myApp.service('appService', ['$rootScope', function ($rootScope) { var events = { firstEvent: "MyFirstEvent", ...
2
votes
2answers
42 views

passing params from controller to service in angularjs

I'm having trouble on figuring out how to pass parameters from my angular controller to service #my controller 'use strict'; angular.module('recipeapp') .controller('recipeCtrl', ['$scope', ...
0
votes
0answers
35 views

Using 2 websockets in one Angularjs controller

I have 2 websocket services: one for historical data and another for current event. Before the current event starts, I want to display historical data that loops through the years. Once the event ...
0
votes
1answer
25 views

angular form name from inside associated controller

I'm very new to angular!! What i'm trying to do is get the form name from inside the associated controller or a reference to the form object from inside the controller. <form name="someName" ...
-1
votes
1answer
46 views

Confusion about data usage in Controllers

How can I use the fetched data in customersController in AnotherCustomersController function customersController($scope, $http) { $http.get("http://www.w3schools.com//website/Customers_JSON.php") ...
0
votes
0answers
43 views

how to fill combo box on page load in angular js?

I have a page which has two combobox in it. This is my view : <div ng-init="loadComboBox()"> <select class="form-control" ng-model="SelectedItem1" ng-options="employee.FirstName for ...
0
votes
2answers
54 views

Using object name when AngularJS variable is defined in $scope

Let's say we have an NameController in AngularJS. There you can define variables like this: this.name = 'Joe'; Or: $scope.name = 'Joe'; I always like to call all variables using the object ...
0
votes
1answer
35 views

Modify elements based on data from ng-repeat

So i've just started learning Angular JS and i'm having troubles to do something that should be really simple but I can't figure out how to do it. Here's my problem... I have a Array of objects from ...
1
vote
1answer
25 views

Trouble getting size of an array in a js object inside controller

I want to get the size of some data I am retrieving in my controller - I have tried the following code; both utilizing a new Object.size function and attempted to get the length property directly ...
0
votes
2answers
40 views

Scope issue in $http success callback

I'm using PHP to get data into my factory, which shows correctly in the success callback function within the controller. However, even after assigning the returned data to $scope.customers, it's not ...
0
votes
2answers
37 views

Can't get this.var to bind correct data in AngularJs

Two Important Notes: 1. My goal is to AVOID using $scope in this case since it's my understanding that impedes the new "controller as" syntax. 2. My problem is likely a variable scope issue and so ...
0
votes
0answers
46 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
1answer
465 views

$scope.$emit not working while $rootScope.$broadcast does

Here's my parent controller where I listen for the event app.controller("SectionLayoutController", function($scope) { $scope.$on("sectionLayout.doAction", function(e, options) { // do some ...
1
vote
1answer
91 views

Sharing a controller scope between two directives with isolate scopes in AngularJS

I have two directives that provide different views on the same set of data. Both of these directives need to rely on central functionality contained in a controller. The controller uses various ...
0
votes
1answer
52 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" ...
1
vote
2answers
42 views

Altering $scope controller variables on URL

I have a simple web app that is just a table with formatted JSON data. When you click on a column, you can filter that column in ascending order. I would like for actions like that to change the url ...
0
votes
2answers
80 views

Send Object From Directive to Parent Controller in AngularJS

How can I send an object back from a directive into the parent controller? I've defined the following directive: app.directive('inspectorSharedObjects', function () { return { restrict: 'E', ...
0
votes
2answers
47 views

Referencing the element that is calling a controller function Angularjs ( ng-change / ng-blur / ng-* ? )

The original question asked about how to determine which element called the controllers blurr function, but I didn't clarify that I was not specifically asking about ng-blur, but ng-* (ng-change, ...
0
votes
1answer
29 views

Referencing the element that's calling a controller function Angularjs

Fairly simple but I can't figure out the term I need to google. How do I reference whichever element is calling the controllers blurr function? html <body ng-app="test"> <div ...
0
votes
1answer
36 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
51 views

Call controller method from directive

I have a button which change the "active" state. First, it loads the status from the server <button active="data.active" ng-click="changeStatus()"></button> directive code: ...
0
votes
1answer
54 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
667 views

AngularJS: $scope.array.push() does not update the view, even with $apply

I'm trying to learn AngularJS and there is this thing that I don't understand, which seems like all the internet solved by using $scope.$apply, but I already use it and it does nothing. Basically, I ...
0
votes
3answers
74 views

AngularJS controller $scope reserved keyword?

I am a newbie to Angular, I came across this fiddle which explains how nested controller works. When I rename $scope to something else say $abc and it doesn't work, does it mean that $scope is a ...
0
votes
1answer
18 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 ...
0
votes
2answers
40 views

Angular $scope set to another $scope value not working

I am trying to give one $scope variable the value of another $scope variable. Can someone tell me what is going wrong? Take a look at the simple plunker for details: ...
0
votes
2answers
44 views

AngularJS load in controllers that are in separate files

app.config(function($routeProvider) { $routeProvider // route for the home page .when('/demo', { templateUrl : 'assets/pages/home.html' }) ...
1
vote
1answer
126 views

Customize AngularJS Bootstrap Tooltip

How do I add custom placements/animations to an AngularJS/Bootstrap tooltip? I can do: myApp.controller('TooltipCtrl', function ($scope) { $scope.htmlTooltip = 'Here is a tooltip!'; }); And it ...
0
votes
3answers
142 views

AngularJS Won't Recognize Multiple Controllers in Single HTML File

I'm finding a weird instance where I am trying to use multiple AngularJS controllers on a single HTML page, and the page will either a, recognize only one of the controllers, or b, recognize none of ...
0
votes
1answer
39 views

function in child controller called from parent view

I have a settings controllers that is responsible of saving settings of my web app. This SettingsController has a simple $scope.saveSettings method. The settings controller is associated with ...
0
votes
1answer
141 views

AngularJS: Directive to Controller communication with scope.apply not working

I have a MainController and a nested Directive. I'm looking at this example to see how the communication works between controllers and directive, but mine doesn't seems to work. Basically, I want to ...
1
vote
1answer
83 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
0answers
36 views

AngularJS factory and controller

little problem here, i have a controller which communicate with factories, but how can i pass the factory result to a function? Something i tried: .controller('testCtrl', ['$scope', 'foo', 'boo', ...
0
votes
1answer
287 views

How to pass $scope data between two partial files in angularjs

How can I pass data in two partial html files using angularJS, totally weird cant get through it. I have one index file [fine.], I login and reach view5 [partials/blog.html] which is written in ...
0
votes
1answer
55 views

On page load pass user id stored in PHP session to AngularJS controller

My controller method: $scope.u = DbResourceSrv.getDbResource('restful.php', 'user', 1) .then(function(data){ $scope.u = data; angular.forEach($scope.u, function(value, key){ ...
3
votes
1answer
264 views

Angular binding model in scope issue?

Hi I am new to the angular js and trying to write the chat application using the socket io and angular js with ionic for android platform. But in my chat page there is one issue. I am trying to bind ...
0
votes
2answers
86 views

In Angular, how to make sure that $broadcast listener is loaded when a message is broadcast

I have two controllers in my Angular app. When a certain piece of data updates in one, it sends out a $broadcast event, like so: $scope.updateTableInfo = function (table) { ...
1
vote
1answer
37 views

How to store/communicate global asynchronous data to controllers

The basic premise is this.... I have an application. When the user hits the application, it immediately fetches various information regarding the user from a sharepoint server through an ajax call. ...
0
votes
1answer
49 views

How do I create a directive with a controller in a way where the scope will work without having to use $parent in the view?

I need to include a controller as an attribute of my-modal. In my example, showModal is not in scope unless I use $parent.showModal = false. I can't use $parent in the view for the sake of other ...
5
votes
3answers
2k views

How to create a two-way data binding between two isolated controllers and a shared service in AngularJS?

I am trying to create a two-way data binding between two isolated controllers and a shared service (which provides another isolated scope): app.factory("sharedScope", function($rootScope) { var ...
0
votes
1answer
601 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
0answers
33 views

Function decomposition of ngTables?

Attempt: $scope.ran_before = false; function table(provider, columns, params, data, parse_data) { params = new ngTableParams ( { page: 1, // show first page ...
0
votes
2answers
53 views

How to escape an angular scope variable in a kiwi template

I have a scope variable (myVar) which is defined in MyController: angular.module('myApp.controllers').controller('MyController', ['$scope', function($scope) { $scope.myVar = 'whatsoever'; }]); ...
0
votes
2answers
97 views

Directive talks to controller but cannot call functions residing in controller

I have a directive which needs to call functions from the Main controller but everytime i try to reference a function inside the directive nothing happens because it's undefined. When I access a value ...
1
vote
3answers
116 views

Best practice for defining scope variables

I have this form. This form contains many many inputs like first name, last name, job title, notes, state, department, documents, supervisor...and so on Originally I had a controller like so ...
1
vote
2answers
125 views

In an AngularJs directive, how do I call its controller's function contained within an directive element's attribute?

I am trying to call a function in a controller, which is part of a custom angular directive, following is the code, Method 1: (Doesn't work: Controller's function doesn't write to the console) HTML: ...
0
votes
2answers
285 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/ ...
3
votes
3answers
1k views

How do I access the $scope variable of one controller from another in Angular.js?

I have this: app.controller('foo1', function ($scope) { $scope.bar = 'foo'; }); app.controller('foo2', function ($scope) { // want to access the $scope of foo1 here, to access bar }); How would ...
1
vote
1answer
879 views

AngularJS sharing data between factory & controller across modules

I have an angularjs app that has several modules. The main modules looks something like: var app = angular.module('mainMod', ['apiService']); app.controller('MainCtrl', function (Socket) { ...
0
votes
3answers
105 views

AnuglarJS - Parsing multiple .then in controller from factory data

I have a controller calling to any set of specified methods in a factory to retrieve information on a given date. Some of the methods iterate through a JSON file to return promise. See factory below ...