In AngularJS, a scope is an object that refers to the application model. It is an execution context for expressions.

learn more… | top users | synonyms

0
votes
1answer
32 views

Pass $scope data from controller to view

I want to display $scope.predicate and $scope.reverse values into my view(in the <p> tag ). It seems that using {{ }} expression is not working. app.js: var app = angular.module('testApp', ...
3
votes
2answers
2k views

AngularJS : update controller scope from directive

I am creating reusable UI components with AngularJS directives. I would like to have a controller that contains my business logic with the nested components (directives). I want the directives to be ...
2
votes
2answers
18 views

I have a code $scope.object1=$scope.object2 , change in object2 is making change in object1

$scope.Object1=$scope.Object2 (assigning to reference and not to value). was this there in angular from beginning or is it a new feature ?
1
vote
2answers
20 views

$resolve not added to $scope until after controller creation

I'm trying to take advantage of the (new in 1.5.0) feature that adds the resolve map to the scope of the route. However, it seems like the map isn't actually getting added to the scope until after ...
0
votes
0answers
9 views

Angularjs cross view update

How to update one view data when a change happen in another view. Like view A.html have a chart and user updates graph data from B.html and goes back to A.html but is not showing the new data. you ...
0
votes
1answer
22 views

AngularJS project structure and defintions

In app.js file I defined the following: var app = angular.module("app", ["ngRoute"]); In testController.js I defined the following: app.controller('testController', ['$scope'], function($scope) { ...
0
votes
1answer
11 views

How to Generate dynamic HTML form (add a new row on-click of button) & retrieve data in angular controller

I want to generate multiple row (inside a HTML form), on-clicking of add-Row button. Actually I am posting snippet of code, in reality my HTML Form is more complex. A row has 2 input box, 4 select ...
11
votes
2answers
249 views

How to do autocomplete dropdown as a grid in angularJS?

Here I created sample for autocomplete, which is working fine and I need to do some modification on this.currently it works like this but what I exactly need is I need to show the dropdown as grid ...
0
votes
1answer
25 views

How to get Values from Other AngularJs Controller $scope variable

I'm having two controllers namely AController and BController. I need to get the value of Controller AController's $scope.myName to the Controller BController's $scope.myName. Note: Here I'm not ...
0
votes
0answers
14 views

Could you please give me a sample of how to create and consume a WCF in angularjs in mvc .net?

In Wcf :- file(EmployeeServices.svc.cs) :- public class EmployeeServices : IEmployeeServices { [WebInvoke(Method = "GET", RequestFormat = WebMessageFormat.Json, ResponseFormat = ...
2
votes
4answers
6k views

Getting data from a web service with Angular.js

Im trying to get data in a Json format from a remote WS using Angular and im having some trouble. The data comes from the web service correctly but i cant use it inside the controller. Why is that? ...
0
votes
2answers
19 views

Accessing $rootScope variable from a directive

So I have a directive that look like this: (function (module) { var node = function (RecursionHelper) { return { restrict: 'E', controller: 'mainController', ...
1
vote
2answers
32 views

Angular documentation about controller this

I recently read in angular documentation (https://code.angularjs.org/1.4.9/docs/guide/providers) this: myApp.controller('DemoController', ['clientId', function DemoController(clientId) { ...
0
votes
1answer
25 views

iterate through sub-objects of ng-repeat with dynamic key value pair

I have a JSON object and I am iterating through this. But, each iterated object has some child objects where I do need to iterate through them as well. JSON structure: [{ 'name': 'a', ...
-3
votes
0answers
17 views

Does Angular support Service Workers like in ReactJS?

We are building mobile lite site and want to use service worker feature of chrome. We are already comfortable using Angular and Angular Ionic. ReactJS has support for service workers. I want to know ...
0
votes
2answers
30 views

Value in view not updating after $promise is resolved

I have a value in my view that is not updating after a service method is called. Here is the relevant code in the controller: $scope.remaining = 20; ...
0
votes
0answers
21 views

How to get scope properties from $route?

I'm beginner with AngularJS and I have problem with kind of $scope: app.run(['$rootScope', '$route', function($rootScope, $route) { $rootScope.$on('$routeChangeSuccess',function() { ...
1
vote
4answers
59 views

Angular - Changing scope is not getting reflected

This is weird as it should be pretty straightforward. I will post my code first and then ask the question: html - <div ng-controller="myController" ng-switch on="addressCards"> ...
1
vote
1answer
58 views

How to calculate row total when using ng-repeat?

I'm trying to create a tracker using AngularJS and I'm having a bit of trouble with my logic when it comes to ng-repeat. Here's what my table looks like to help explain what I'm trying to do: So ...
1
vote
0answers
19 views

AngularJS:Error , Array value existing even after set to null?

function detailCtrl($scope, $state, $stateParams, documentService, $q) { var self = this; self.detailedDocObj = null; init(); function init() { ...
0
votes
1answer
30 views

What is the difference between set value directly to $scope and via jquery value?

Here I created sample text box value binding which is working fine. if I Enter value directly in text box 0,1,2,3 it will update the value fine. I created one submit button if I clicked I updated text ...
0
votes
3answers
27 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": ...
1
vote
2answers
501 views

filter:notarray Expected array but received: 0

controller @RequestMapping(value = "/graphs", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) public Collection<Graph> getSkeletonGraph() { ...
0
votes
1answer
17 views

Change child scope using broadcast from app.run

I have an angular app with the name DemoProject. I have an app.run controller and one child controller JS var app = angular.module("DemoProject", ['ngRoute', 'ngAnimate', 'ngMessages', ...
0
votes
0answers
18 views

Globally available Angular functions using $scope variable

I'm dealing with a simple problem in AngularJS regarding the visibility of functions between controllers and the $scope and $rootScope variables. To clarify, I have a couple of functions in several ...
3
votes
2answers
26 views

Angularjs Scope in Jquery Modal popup

js 1.3 with jquery. I have to display a form input in modal window. For which I have written a jquery function which will open the hidden dom content in Modal window. ShowModal.open({ content: ...
0
votes
0answers
9 views

Change Values for an angularJS child Controller property in app.run

I having a angular module app in the name of the ng-app DemoProject. Now I'm creating app.run controller and one child controller My AngularJS Script var app = angular.module("DemoProject", ...
0
votes
3answers
43 views

AngularJS: Dynamically binding Click in directive gets fired multiple times

I'm trying to add fields dynamically and I'm binding click event in the directive's link function. But it seems to be firing several times as I add more fields. See the example below - var clicks ...
0
votes
4answers
47 views

console.log for $scope in angualr js

Why I'm not able to console output $scope values ? I'm trying to extract user assigned values from the pages and retrieve in controller. Eventually i would like to pass this to service so multiple ...
5
votes
3answers
3k views

Angularjs unit test watch callback not getting called even with scope.$digest

I'm struggling unit testing a controller that watches a couple variables. In my unit tests, I can't get the callback for the $watch function to be called, even when calling scope.$digest(). Seems like ...
0
votes
2answers
39 views

Getting “#” along with URL while running angular application in web browser

I have created an application using angularJS framework. While running application on web browser, i am gettting # along with my url. I tried the following below, var app = ...
0
votes
2answers
30 views

Difference between using Angular $scope dependency and no dependency

There is something that i don't understand with Angular. I'm new to Angular, and i don't remember where but the tutorial that teached me used this syntax do apply properties to a controller's scope : ...
4
votes
1answer
5k views

Using Angular for search inbox (like Google search)

I want something like Google search matches. When I type something Google gives me some options which match the words I have typed so far; for example if I type "Rog" it gives me the options of ...
0
votes
0answers
47 views

AngularJS Custom Directive Isolated Scope is not working

I'm trying to create a Spinner, I have a custom directive in AngularJS var app = angular.module('plunker', []) .directive('spinner', function() { return { restrict: 'EA', scope: { ...
0
votes
1answer
20 views

How to do dynamic Helpcontext with anchor scroll in angularjs?

Here I created a sample for a dynamic Help Context. Based on the page it will load dynamic help data which is working fine. In local $anchorScroll is also working fine. What I need exactly is while ...
1
vote
1answer
30 views

Angularjs dynamically adding and removing elements using directive

I used directive for creating contact form. Initially i create customerForm directive for displaying customer form. In that form i have one button, when we click on add button, called getData function ...
1
vote
3answers
55 views

How to get current Controller $scope inside directive function in angularjs?

Sample Link : Example Hi all, I created one Global Help button in index file based on url am loading dynamic help(html file) which is working fine. I need to identify which controller is activated ...
1
vote
2answers
26 views

POSTing item from ng-repeat

I have a simple ng-repeat, that displays a list of addresses. Next to each address is a button, when clicked, i want to perform a HTTP:POST. I know know how to perform a REST call, but im struggling ...
0
votes
0answers
16 views

Angular using two way binding on appended and compiled attributes

I'm working on attaching html elements with directives from another directive. I've managed to successfully append the html elements with directives using this answer. But, the values added to these ...
1
vote
2answers
33 views

Angular scope not updating when passed in object to function

I have a controller function which is called on double click of an item in an ng repeat: $scope.likeUpdate = function(update) { $http.post( $rootScope.apiURL + 'likeupdate', { update_id : ...
1
vote
1answer
1k views

ng-click not working in dynamically created content

I have this function in Angular where I add a new slide with a ng-click in it. var addSlide = function($scope, slideIndex, $event) { slideIndex++; var slider = angular.element('.slick-slider'); ...
1
vote
1answer
36 views

Updating a single item in angular scope object

I am creating a like function for pictures on an Ionic app. I can return a like count and true or false for if the request was to like or unlike a photo. I have a function on my photos which calls a ...
0
votes
1answer
41 views

Angular services: is it bad practice to assign response to an object or should I only use resolve

I have seen this code, which works for me but I wonder if it's bad practice to create an object inside the service- assign it to this and then to assign the response to the object in the success ...
0
votes
0answers
28 views

How to refactor a controller with lots of watches

I have a controller with lots of watches (only shown one here) and i want to move the watch code/logic outside the controller to make it thin. See the code below. The commented out portion below ...
1
vote
1answer
221 views

How to call a JSON file from Angularjs Module

I am new in AngularJS. I have a situation where I need to call and read a json file. Here is my Code <!DOCTYPE html> <html> <head> <script ...
1
vote
2answers
2k views

AngularJS $scope.push not updating the view from a $http data response

I’m performing a $http request to the 500px API for a set of popular photos. The response object is being returned successfully, and I’m having trouble pushing the returned photo items to the view. ...
0
votes
0answers
20 views

Get variable value in scope from its string name

I have a string in a directive patientCtrl.user.first_name It is a string get from attributes, I need to get the value of the variable instead the string name
0
votes
1answer
47 views

How to get $scope from inside a controller function?

I have the following problem: I have a function inside a controller, and the function decides the value of a $scope.name app.controller('myController', ['$scope', function($scope) { function ...
1
vote
6answers
48 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) { ...
-1
votes
0answers
13 views

i want to show loading icon if it gets hit to server for specific partial views each

I want to show loading icon inside of two partial pages if they get hit to server. currently i am using progress bar on top of the page, but i want to use loading icon for both the partial views if ...