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
2answers
22 views

Slow Angularjs page initialization - long delay before html loading

I'm running an angularjs app, and can't figure out why my page is loading slowly. The css and js files all load quickly, but there is a long delay between that and when the html loads, where the app ...
5
votes
1answer
4k views

AngularJS - Using ternary operators and filters within a binding

I current have a simple data binding: {{ myAccount.Balance }} I think applied a couple of filters: {{ myAccount.Balance | filter1 | filter2 }} However, i want to use a ternary operator when the ...
0
votes
1answer
18 views

I have 2 app.run method.how to halt in first method until promise is resolved?

angular.module('app', [ ... ]) .constant('AppConstants', constants) .config(appConfig) .run((UserService, User) => { 'ngInject'; console.log('apprun') UserService.acl() ...
1
vote
1answer
29 views

angularjs scope array not shown when data is in

I have scope array property. I'm filling in the data by calling ajax service. What is happening is that even the data is populated in the array as expected I need to focus some other control or click ...
2
votes
3answers
45 views

Why ng-click not working when i got in $scope.variabel?

I have problem, my ngclick not working because i got in $scope.variabel controller. <a id="data_table" ng-click="{{ item.target }}" I think target can use in ng-click when we call {{ item.target ...
1
vote
5answers
54 views

Calculate total price in AngularJS

I'm trying to make this code to get the final number of the sum of all detalle.price elements. They are all numbers so I need to sum them and post the final number on sum(). <div id="pedidos_table"...
0
votes
3answers
23 views

Angular: Assign $scope value from ng-init to new variable

As per mentioned, Is it possible to assign $scope variable from ng-init to new variable? see this plunkr If you see on my plunker, variable $scope.adulttotTicket have value of total ticket which is ...
-1
votes
2answers
38 views

angularjs pass index throuhg directive

i need help with this code. <ul ng-init="round = 'round'"> <li ng-repeat="mesa in mesas" ng-click="selected($index)"> <div id="{{round}}">&nbsp;</div> MESA {{...
18
votes
4answers
12k views

Use of symbols '@', '&', '=' and '>' in custom directive's scope binding: AngularJS

I have read a lot about the use of these symbols in the implementation of custom directive in AngularJS but the concept is still not clear. I mean, what does it mean If I use one of scope value in ...
0
votes
1answer
22 views

angularjs filter multidimensional object json

I wnt to use ng-repeat to display a list filtered by an object value. Here is a plukr of my attempt https://plnkr.co/edit/vD4UfzM4Qg7c0WGTeY18?p=preview The following returns all of my JSON names as ...
0
votes
3answers
29 views

Angular JS : Post call is going in Success as well as Error Method

I know I amy look like foolish while asking this, but I am not able to figure this out. I have written a service which handles the post call to the server. $q service is returning the promise back ...
155
votes
5answers
161k views

How to set the id attribute of a HTML element dynamically with angular js?

Provided an HTML element of type div, how to set the value of its id attribute, which is the concatenation of a scope variable and a string ?
2
votes
3answers
53 views

NgRepeat is not updating from an updated array

I have an app that gets a collection of data (i.e. 400 objects) and stores it in an array. In my view I'm creating a kind of infinite scroll, that basically when the page loads, it insert 5 records. ...
1
vote
2answers
41 views

AngularJS ng-model not doing two way data binding

I have a label with an input box like so: <label class="item item-input"> <input type="text" data-ng-model="description" placeholder="Add a Description!"> </label> As you ...
0
votes
2answers
22 views

angular controller scope with html

I have this code in controller ` (function () { 'use strict'; var LoginController = function($scope, $http, $timeout,$location,User) { $scope.user = {}; $scope.flags = { error: false, ...
0
votes
1answer
25 views

Why is my $scope not updating in my View in Angular when using $location with angular-route?

Does anyone know why my $scope.userData isn't rendering in my View when using angular-route and Angular's $location service together? My Situation: In the code example below, I have an index page ...
0
votes
1answer
83 views

ui-sref include parameter in ng-repeat loop

I have this table: <table class="table tenant-table text-center"> <thead> <tr> <th class="text-center"> ...
0
votes
1answer
13 views

Data not being populated in drop down from JSON Response from REST in Angular js

I'm getting a JSON value from one WebService like this "electricity": { "selectedElectricityBoard":"ABCD", "electrictyConsumerNumber":"12345", "isElectricityBoardChecked":true ...
0
votes
2answers
1k views

Dynamically create directives from a loop

I have a main directive that has an array on it's scope that contains data for constructing other directives that should be compiled and appended to the main directive. The problem is that when I ...
1
vote
1answer
17 views

How to bind different scopes from one controller to the one?

I have a controller that I use in two places: in a ng-view and in a ng-include. These places are not child or parent to each other, but I want to some changes made in the ng-view affect to ng-include ...
5
votes
3answers
4k views

Using $emit in angular 1.5 component

I am using angular 1.5 component and need to call function in parent controller from when $emit in child component. How we can do this? Example: (function (angular) { 'use strict'; ...
0
votes
0answers
11 views

My scope always say it is undefined. I use $scope inside bunch of function which are in same controller

Following is my code which always says that $scope is undefined. Where should I use $scope. app.controller("ControllerName", function ($scope,$log,ServiceName) { $scope.getAll = function (...
-2
votes
0answers
29 views

How to convert the below Jquery to angular inside run block

Jquery to angular conversion needed inside run block. html <body class="modal-open" style="padding-right: 17px;"> Js $('body').removeClass('modal-open').removeAttr('style');
0
votes
1answer
16 views

Injecting $location service makes my url with fragment identifier weird

Here is my angular code var app = angular.module('app', []); app.controller('mainController', ['$location', '$scope', '$log', function(location, scope, log) { log.info(location.path()); }]); And ...
19
votes
4answers
11k views

Angular Get Controller from Element

Is there a way to find the controller for an element through Chrome's console? I can get a reference to the component by selecting the element in the Elements Panel and using var c = angular.element(...
2
votes
1answer
51 views

Update element created by directive on change of controller varibale

I am trying to create an angular app where user can create a dynamic form. In this user can create form fields and save form metadata, which is then used to display actual form. There is live preview, ...
1
vote
4answers
37 views

how to get text area empty automatically when user click anywhere on the page. Angularjs, Javascript?

I'm working in angularjs project, I have one text area which gives me some result on search.I want my text area to be cleared whenever i click anywhere on the page.My code is <input type="text" ng-...
1
vote
2answers
37 views

dynamic ng-model using multiple dropdown and ng-reapeat

Hello every one i have a language multiple selection input. On select language i need to open textboxes of selected language with dynamic ng-model. this is my json and code. [{"id":"1","lang":"...
0
votes
0answers
17 views

angularFileUpload don't fire event

i am trying to do a file upload with angularFileUpload module, so in my view i have something like this: Upload image <input type="file" data-ng-file-select="onFileSelect($files)" accept="...
0
votes
1answer
33 views

Can a $rootScope variable be passed in state file - AngularJS

I'm working on an Angular project and currently am working on making the entire project configurable. I have an object which contains an array of elements, each element being an object with the ...
0
votes
1answer
51 views

Using $q.all sometimes causes selects to not read the model correctly

I noticed that one of my select dropdowns would occasionally not have the correct item selected from the Angular model. I traced it down to be what appears an issue with promises not fulfilling before ...
0
votes
1answer
27 views

Notification alert service not working in controller getting typeError: Cannot read property 'alerts' of undefined

I have capturing the application response error ,while capturing the error, i am getting the error. In Interceptor ,according to the response code , have assign the rootscope broadcast and show the ...
1
vote
1answer
56 views

angular 1.6.1 '&' binding issues

Problem: When I bind '&' under ng-repeat(or without for that matter atm), I can't seem to trigger the parent scope's function. HTML <div ng-repeat="type in fC.types"> <repeater type="...
807
votes
7answers
631k views

How do I use $scope.$watch and $scope.$apply in AngularJS?

I don't understand how to use $scope.$watch and $scope.$apply. The official documentation isn't helpful. What I don't understand specifically: Are they connected to the DOM? How can I update DOM ...
-1
votes
1answer
17 views

How to update the directive when the parent's scope variable changes?

Directive: <div ng-show="{{ show }}"> ... </div> angular.module('mymodule').directive('mydirective', [ function () { return { scope: { show: '=' }...
4
votes
2answers
36 views

Angular JS passes App ID and Key with every request

I have a basic angular APP that makes a GET request call to a API URL. The data returned is in JSON format. The API documentation states the following: You must provide your App ID and key with ...
20
votes
2answers
12k views

Rendering directives within $sce.trustAsHtml

I've included a Plunker here: http://plnkr.co/edit/4vqV8toHo0vNjtfICtzI?p=preview I'm trying to add a button to the DOM and when clicked should execute the function bound to it. In this case it ...
1
vote
1answer
49 views

Differnce between $scope.Variable and $scope.Function in Angular?

$scope.some_random_variable = "random_value"; $scope.some_random_function = function(random_param){ console.log("randomness"); } I want to know the difference in the context of digest cycle. As ...
1
vote
3answers
52 views

AngularJs ng-repeat custom structure

I have a dataset like this $scope.dataset= [ {"Name":"Alfreds Futterkiste","City":"Berlin","Country":"Germany"}, {"Name":"Ana Trujillo","City":"México D.F.","Country":"Mexico"}, {"Name"...
0
votes
1answer
19 views

Angularjs Class Confirm button

I am trying to create a "confirm" button for users of my website to see when they click on a button, and I am using an angularJS class. My code is as follows: class TodosListCtrl { constructor($...
0
votes
1answer
53 views

Why is $scope not working in Angular 1.6.1?

Background After following the AngularJS tutorial on codeSchool and reading some StackOverflow questions, I decided to start using $scope in order to avoid the hassle of having to define a var self = ...
0
votes
1answer
432 views

Migrating to Angular 2.0 and BindToController

So, I was reading about migrating to Angular 2.0 and trying to understand better ways in which directives/components could talk to each other. I followed some of the guidelines here which suggest to ...
74
votes
10answers
171k views

Get value when selected ng-option changes

I have in my .html page a dropdown list, Dropdown: <select ng-model="blisterPackTemplateSelected" data-ng-options="blisterPackTemplate as blisterPackTemplate.name for blisterPackTemplate in ...
1
vote
1answer
23 views

Adding Form Fields Dynamically in angularjs not working

I am developing an online course application. I am trying to add form fields dynamically in my application, so that I can add more video lecture for a course. However, when I click on "Add Another URL"...
2
votes
1answer
36 views

can't pass dynamic parameter to angular directive

I just took over the frontend work of our angularjs apps and I'm stuck. I've been creating directives to replace bloated html to make updating the frontend look easier. All was going well till I hit ...
0
votes
0answers
78 views

$compile directive not hiding elements in ng-repeat

After upgrading from Angular 1.3.2 to 1.5.11 it appears my custom restrict directive is no longer working as expected. The directive is responsible for hiding elements through comparing a user's roles ...
0
votes
1answer
22 views

Passing Controller's $scope variable to nested directive's controller

I'm having trouble passing a scope object from one controller to a nested directive's controller. I have a directive (child) within another directive (parent), the parent directive and its controller ...
0
votes
2answers
24 views

Add/Remove class if checkbox is checked/unchecked (AngularJS)

I need to toggle a class if a checkbox is checked/unchecked with AngularJS. My Code is working on Plunker but in my controller there is no functionality. Here is the Plunker: Click! My Controller ...
0
votes
3answers
55 views

How to iterate through angular $scope variables with a for loop

I want to iterate through an array using for loop instead of using foreach in which i m not able to break the loop. But here in for loop i getting $scope.items[i] as undefined! here i m dynamically ...
0
votes
1answer
29 views

Angularjs - How to set value of Global variable according to one of the response data element

I want to set the value of glovalvar according to defined in function hello I am getting response data & according to that I want to set globalvar Value. Here is snippet: var app = angular....