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

3
votes
4answers
700 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 ...
1
vote
1answer
15 views

Firing event from dynamically opened controller to parent controller in Angular js

I am developing an Web Application using Angular JS. Frankly, I am new to Angular JS. in my app I am using bootstrap.ui js for angular js. But I am having a problem with bootstrap modal controller. I ...
0
votes
2answers
16 views

Parsing parameters onclick for angularjs app

I am working on enhancing a feature of an already deployed application. All the js code is minified and i only can excess html files. I need to call a function on-click of a 'div' which parse some ...
1
vote
0answers
19 views

ng-repeat=“todo in todods” How do I access 'todo' outside of ng-repeat?

I can only access the clicked 'todo' within ng-repeat. In order to access it else where, for example within the col-sm-8 div, I have to pass it into my controller. Once I pass it in my controller, I ...
-1
votes
1answer
18 views

How to inherit functions from a parent component in angular2

I am new to angular2, feel free to help me tune my vocabulary / terminology I have a class that is composed of two directives like so: in parent.component.ts, the Parent is made up of Foo and Bar @...
0
votes
1answer
22 views

Toggling accordion classes use angular js

I have created a custom Angular accordion menu. I have the basics working the menus open and close. One issue i am having when I click on toggle menu two i want the added class on toggle menu one to ...
0
votes
1answer
15 views

Pass Data to Service from Controller AFTER receiving info from Server

I need to pass data to an array in service after getting from server. The controller runs the function to retrieve data as shown .controller("messagesController", function($scope, $stateParams, ...
3
votes
1answer
861 views

why list is not display while using collection-repeat instead of ng-repeat

I used ng -repeat in my demo .But due to large data coming from service .I want to use collection-repeat for performance better .how I will use collection-repeat to get the same out put here .here ...
0
votes
4answers
71 views

ng-show is not working

I am using AngularJs since long time but finding a strange issue. The below code works well var app=angular.module("list",[]); app.controller("myctrl",function($scope){ $scope.get=...
0
votes
2answers
27 views

Map not showing first time I enter in the screen

The following html code loads a google map: <div> Map : <div ng-controller = "CreateNewEvent" id="map" style="width: 100%; height: 400px" data-tap-disabled="true" ng-init="initMap()">...
3
votes
1answer
440 views

Angular hide header on scroll down, show on scroll up

I am trying to recreate this fiddle: http://jsfiddle.net/mariusc23/s6mLJ/31/ using AngularJS. Effectively, when the user scrolls down the page, the header disappears. If, at any point, the user ...
1
vote
3answers
37 views

Ng-if wont render ng-repeat on the screen

I am taking a numerical input from user. I'm asking how many number of people do you want? Lets assume the user entered 3. Each "people" have a firstname and a lastname. As soon as the user enters ...
0
votes
0answers
33 views

How to fix angular bootstrap error

My project is non-angular and is using jquery. I am calling a html dialog which loads angular code. Since the dialog is dynamically loaded (in my project using ajax) I need to bootstrap at the end to ...
0
votes
3answers
37 views

Get the index of the click element

I am trying to get the index of the clicked element but I keep getting -1 in the console. I am using Array.prototype to get the indexOf from the nodelist HTML: <div ng-app='app' ng-controller='...
0
votes
0answers
34 views

ng-model not scope data with ctrl

I need to send form with post method to url. All ng-select field work, but only one input field not. Here is code. I add ctrl to ui-state like all other ctrl. > https://plnkr.co/edit/...
1
vote
1answer
23 views

how to use $compile in angular component angular 1.5 and above

I am migrating from directive to component but error is getting while using $compile As : $compile(ReturnDomElement)(scope); What should be used instead Of $scope As I dont injected $scope in my ...
0
votes
0answers
11 views

Angular Drag&Drop transclusion

I have a specific problem with two sibling-directives which are under one Controller: I want to drag the copy of a chip and not the original, so I have to copy the element on the dragstart event. It ...
0
votes
1answer
23 views

Set $scope variable inside Angular Service

I have this Service in AngularJS: this.getProductsSiteService = function(idSite) { return $http.get(BASE_URL + 'obtener/productos/sitio/'+idSite); } It works fine. I use the method below for ...
0
votes
0answers
27 views

Understanding $$watchers in Angularjs

What is $$watchers? Angular keep watch on data with directives(most) and {{}}. a. How does it behaves in case of expression/filter/regular_data? b. On what watch is kept on(in case of expression/...
14
votes
3answers
8k 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(...
4
votes
2answers
26 views

My AngularJS scope is not working as expected

I'm a newbie to AngularJS. I was working with the basic scope concept. In my code, there is a Parent Controller and Child Controller. View <div ng-controller="ParentController"> <input ...
0
votes
0answers
19 views

Programmatical variable change in directive does not run parent scope validation

I have a form that comprises a circle in a map. The "circle picker" is implemented as a directive that renders a GoogleMaps map and updates a two-way bound object (with '=' in directive scope) from ...
0
votes
1answer
29 views

How to put the heading as the first binding and content below that while heading alone have mark

<li class="checked-list" ng-repeat="detail in ctrl.details">Your details are <strong ng-bind="detail.Id"></strong>. <br/> <span ng-bind="detail.description"></...
1
vote
1answer
16 views

Adding configuration file to Angular 1 how should the file be structured in order to use it

I have been wanting to have a central place for a configuration file with angular 1.5.8 that I can use for switching from JSON file to localhost to dev server and various other things. I noticed $...
1
vote
1answer
24 views

Picture won't display as part of my little angularjs app

I wrote a little app that converts Fahrenheit to Celsius and I want a picture to display based on the Fahrenheit temperature. I can't get the picture to display. Can someone tell me where I'm going ...
1
vote
1answer
38 views

AngularJS: Update all objects in $scope simultaneously

Say I have an object stored in $scope like so: $scope.todo = [ { "title" : "Groceries", "todoItems" : [ { "title" : "Milk", "status" : "Not Done" }, { ...
12
votes
4answers
41k views

AngularJS push item to first or 0 index of $scope array

Please help me implement this function. I have an array of items in my $scope. Now, when I click on the Add Item button, I want to push a new item to the first index or 0 index of that array. Thanks ...
32
votes
5answers
10k views

How to expose a public API from a directive that is a reusable component?

Having a directive in angular that is a reusable component, what is the best practice to expose a public API that can be accessed from the controller? So when there are multiple instances of the ...
0
votes
1answer
46 views

passing data through Angular custom directive

I created a custom directive in angular. I would like to pass parent data through the directive using scope but I'm getting 'undefined' when I log scope and scope.questionId. HTML <a class="...
0
votes
2answers
31 views

How to pass a value (which i got from ui-router) to a modal/view through state.js?

My state. js is like this .state('lab.new-equip', { parent: 'lab', url: '/{labId}/new-equipment', data: { authorities: ['ROLE_USER'] }...
0
votes
2answers
42 views

Angular directive scope value [duplicate]

<tab page="book"> </tab> <tab page="dial"> </tab> <tab page="groupe"> </tab> <tab page="log"> </tab> <tab page="star"> </tab> As ...
0
votes
0answers
37 views

Two way binding in angularjs directive with dynamic templateURL

This is the directive code: App.directive('postTemplate', function () { return { link: function (scope, element, attrs, model) { //console.log("doing nothing"); }, ...
0
votes
2answers
48 views

Angular ng-repeat to print array values in a HTML table

I have an array in my app.js file, contents of which I would like to print sequentially in rows in my HTML table. Below is my app.js file: (function () { var app = angular.module('TravelI', []); ...
0
votes
0answers
39 views

Handling Json response dynamically in angularjs

Json: { "json": { "response": { "servicetype": "1", "functiontype": "10011", "statuscode": "0", "statusmessage": "Success", "data":{ "roleid": 36, ...
0
votes
1answer
28 views

Retrieving model values from dynamically opened controller's scope in Angular js

I am developing an Web Application using Angular JS. Frankly, I am newbie to Angular JS. Very new. In my app, I need to dynamically add and remove elements. I use directive for it. Adding and removing ...
1
vote
1answer
36 views

Not able to display the object array values in the dynamically inserted view using angular Js

I have just started to learn AngularJS. I am trying to write this code with 3 files index.html and view1.html and view2.html . In index.html I have defined the module and controller function.In the ...
1
vote
2answers
64 views

$compile not updating dynamically generated html runtime

Here is jsfiddle: https://jsfiddle.net/vikramkute/eq3zpmp9/5/ I am new to angular. I have an object which needs to be appended runtime in html. I am using angular 1.2.25 Expected output is 1 ...
0
votes
1answer
28 views

AngularJS displaying a list of objects from rest endpoint?

I have a Hipster application that I want to use to display a list of words on a page generated by user input. Ex: A user enters the string 'ba' and the application generates a list of all words that ...
1
vote
1answer
37 views

How does $scope.$on work and $destroy get invoked?

Can anyone please explain about the working of $scope.$on and how does $destroy work in these two controllers. Like when I change the route, a different controller gets called, is that why $destroy ...
1
vote
1answer
28 views

Ng-Table is not binding from NgTableParams with server side data

Unable to bind the table with data i.e. collected from service. Controller code is as: app.controller('outletTypeController', ['$scope', '$location', '$timeout', 'outletTypesService', '$uibModal', '...
1
vote
1answer
36 views

Key value pair storing and iteration in angular

{ "ordersList": [{ "ordersDto": { "testMast": { "testId": 9, "testName": "HIV" }, "sample": { "sampleId":...
3
votes
1answer
63 views

In a reusable component Angular directive which wraps another directive, how can I make a model “pass through”?

In Angular, I'm creating a directive for a reusable component that wraps ui-select (to automate integration with REST services). My directive will be invoked roughly like this: <rest-backed-...
0
votes
2answers
46 views

Angular: select ng-model programmatically changed but ng-change event doesn't fire

Here's my select element: <select class="small-3 columns end statSelect" ng-model="chart.categoryAxis" ng-change="renderMainChart()" ng-options="metric as metric....
0
votes
4answers
29 views

Angular JS form submission issue

I want to add an entry to my reviews array. <b>Submit a review</b> <form name="submitReviews" ng-controller="ReviewController as reviewCtrl" ng-submit="reviewCtrl.addReview(...
14
votes
2answers
3k views

Angular 2 - Substitute for $scope.$apply?

$scope.$apply will no longer be part of Angular 2. Then how do we let Angular know to update the DOM if any of the bound properties have been changed outside the regular angular execution context? ...
4
votes
3answers
496 views

AngularJS scope doesn't update until do something in ui, like click a object with a function

I am trying to add class to my sidebar when the viewport is less than or equal to 641px, and I have to watch the width of the window for that case $scope.$watch(function(){ return $window....
0
votes
2answers
23 views

How to test self. angularjs controller functions in jasmine

I have the below code inside my controller Controller: self.DoSomething = function () { self.x="hai"; self.y = function (id, data) { self.x="hello"; } } $scope.Call=function(){ ...
0
votes
1answer
32 views

How to change form value from different controller in AngularJS

I have following html (sample) <div ng-controller='ctrl-1'> <form> <input type='text' ng-model='name'/> </form> </div> And js file as: app.controller('...
-2
votes
1answer
21 views

Prevent change of object in original array when updating filtered object

I have an array $scope.items = [{id:1 , name:'john'},{id:2, name:'doe'}]; Now i am filtering object from the array $scope.newItem = $filter('filter')($scope.items, {id: 1})[0]; Then, i am ...
0
votes
0answers
30 views

Get JSON array object specific Id depending on which item i click on AngularJS

So i have a table with a list of teams, what i want to do is when i click on a team name it displays a new view with team details. There is 2 controllers, 1 to get league table and fixtures and then 1 ...