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
0answers
1k views

AngularJS - dynamically remove directive from element

What is the proper way to dynamically add or remove directive from compiled and linked element? I have a page that has bunch of inputs there (the list is pretty long, so i want to come up with a ...
2
votes
0answers
30 views

directive doesn't load correct after ngroute

I've got a Problem with an isolated scope in my custom directive. I've built a custom directive. It worked when I didn't set the scope-attribute in the directive by using the parent scope. What did ...
2
votes
0answers
33 views

AngularJS - Improving service call and data binding performance

I have an Angular service that goes away to retrieve a pretty big JSON file (nearly 10,000 lines). The problem i am facing, is that it is taking some time to bind the data to the front-end (as ...
2
votes
0answers
45 views

How to bind AJAX-loaded form to 'ngModel' [close]

Received http://examle.com/ajax/login.html: <form method="post" action="/login.html" name="formLogin" data-ng-model="formLogin" data-ng-submit="submitLogin($event)" novalidate="novalidate" > ...
2
votes
0answers
35 views

Ways to send $scope to be used into prototype functions

I'm trying to figure out ways to let the $scope available to access from my prototype methods: Sending $scope as a parameter: var myController = function($scope, Service) { $scope.myMethod = ...
2
votes
0answers
134 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 ...
2
votes
0answers
28 views

Getting a list of all events that can potentially pass through an angular scope. $$listenerCount?

Inside a directive I am trying to get a list of all event names that can potentially be captured by the given scope. When observing the scope object, I can see that there is a $$listeners property, ...
2
votes
0answers
186 views

Communication between nested directives

I'm trying to communicate between a parent directive and its nested child directive, and the other way. I've managed to achieve this by using $broadcast and $emit, but because I'm passing in some ...
2
votes
0answers
91 views

Angular: why isn't $evalAsync called $applyAsync?

Angular beginner question about scopes (docs here). $eval executes an expression in the context of a scope. $apply basically calls $eval and then $digest. Why does $evalAsync call $digest too (or, ...
2
votes
0answers
348 views

Difference between template and templateUrl in angular js directive in isolated scope

I have a directive in isolated scope and i define a couple of variables in link function of the directives so the template fails to bind to these variables but templateUrl seems to bind to these ...
2
votes
0answers
176 views

Sharing isolate scope with nested directives in Angular

I want to have a custom directive that is reusable and creates an isolate scope so it can be used anywhere (as long as the consumer uses the API defined by the directive). Then, I want the consumer ...
2
votes
0answers
609 views

Angular set ng-minlength from controller does not work

Here is the controller: function Ctrl($scope) { $scope.text = 'guest'; $scope.word = /^\w*$/; $scope.min_length = 4; } Here is the view: <form name="myForm" ...
1
vote
0answers
6 views

Angular ui-sortable + angular-gridster

I'm trying to combine the functionality of ui-sortable and angular-gridster so that I can pull an item from a list and drop it into a rearrangeable grid. ui-sortable and angular-gridster have the same ...
1
vote
0answers
30 views

Push non-angular object to AngularJs controller scope

I have a Angular controller that have a FormData scope, e.g: $scope.FormData. Data is collected via model connected to a simple form. Also, I have an external non-angular js code on the page. I need ...
1
vote
0answers
28 views

AngularJs TemplateUrl

I have two directive and I want to dynamic templateurl with attr. For example; I want to send attr with deviceEmpty tag. If this tag not null, use this tag. If this tag use static url. AngularJs ...
1
vote
0answers
14 views

angularjs: requireing and using tabsetCtrl.select

I am trying to create a directive that will automatically activate angular-ui tabs based on routes. my directive is intended to be added to every tab element within the tabset. I am requiring ...
1
vote
0answers
16 views

How to share data in between two controllers using angular JS?

I am new to angular JS and Javascript. I am working on a angularJS project and In project i am using several modules like Secreport -> secreportpage -> secchart. I passed data from mainCtrl to ...
1
vote
0answers
24 views

Check form validity from inside directive

I have a directive which watches if a form is submitted (so I can style validations only after they hit submit). The problem is I cant 'reset' the form after it's successfully submitted. How would I ...
1
vote
0answers
23 views

$scope.$emit with partials

My domain.tld/login is a partial (login.html) included within the index.html. index.html also ng-include's a partial that is visible based on ng-if attribute. The idea is to evaluate ng-if condition ...
1
vote
0answers
39 views

Angular While enabling html5mode gives Error: $rootScope:infdig Infinite $digest Loop

When I try to remove # from the URL by enabling the html5mode gives the following error for the initial loading. Error: $rootScope:infdig Infinite $digest Loop when the html5mode is false ...
1
vote
0answers
27 views

flipcard within angularjs directive with limited scope

I have this html code with CSS. I want to put this in a directive template and re-use the directive, limiting scope to each element. <div ng-controller="flipCtrl"> <div ...
1
vote
0answers
44 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
0answers
20 views

Does using “controller as” syntax can help to find a scope of a controller in AngularJS?

I read about this new feature, very nice when you have nested controller, help to understand the binding element, where everything is coming from. But I'm curious if this also can help me to find a ...
1
vote
0answers
25 views

Referring to nested object in controller through Angular expression

A quick challenge for all you angular wiz out there. Say in my controller I have something like app.controller('testController', function ($scope) { preWrittenFunction1 (function callBack () ...
1
vote
0answers
37 views

Directive Does Not Inherit Controller's Scope

I have a controller set up which contains a few functions to do form validation. In this controllers $scope I have an array $scope.errorMsgs that is populated with strings of error messages the user ...
1
vote
0answers
31 views

How can I set a Translated Title in AngularJS

There are other answers that show how to set a HTML title in AngularJS. This is my variation which works for basic cases even while using angular-translate: <title ng-controller="PageCtrl" ...
1
vote
0answers
47 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 ...
1
vote
0answers
313 views

Custom Filters in kibana Dashboard

In Kibana, I am trying to create filters with default values similar to the existing time filter in header. I went through the code and found that this function is taken care in ...
1
vote
0answers
46 views

AngularJS - JSON and return all results

I'm trying to write a basic search function using AngularJS. I have written a service that finds my JSON file and binds it to a $scope object $scope.SearchResult What i am trying to do it perform a ...
1
vote
0answers
49 views

Data binding with `ng-model` not working on some systems

Quite strange, but yes the same code works on one system but not on the other. I developed a HTML-5 based extension for Adobe Creative Cloud Applications (Adobe CC have the chromium framework built ...
1
vote
0answers
43 views

What are the advantages/disadvantages to a declarative template? ViewModel approach?

When talking about a declarative syntax in angularjs we usually always bring up directives, and how we can pass $scope properties down into these directives for processing, DOM manipulation, data ...
1
vote
0answers
116 views

value changed in ng-model in templatedUrl is undefined in directive

initially when i load it works fine but when i change the value in template URl for ng-model scope.value is undefined inside my link. i am making directive for datepicker bootstrap angularjs. ...
1
vote
0answers
51 views

angular.element replaceWith not working

I have an element to replace and the html text is in varaiable h The first call to this works perfectly. But the second call does not. var newElement; var h="<div>a</div>"; newElement = ...
1
vote
0answers
72 views

Sometime scope variable not getting set

This seems pretty strange to me but I hope there's someone that has come across this before and point me in the right direction. I have a variable being set in scope within an $interval and the ...
1
vote
0answers
134 views

angularjs ng-click not working inside the pop over directive

I added some buttons in the pop over template. when the page finishes the first loading, click on the element on the page, shows the popover, click on those buttons, every one works fine. But when ...
1
vote
0answers
32 views

Getting error while calling function from element attributes

Trying for creating multiple progress bar with dynamic value <progressbar class="progress-striped active" value="{{getValue(value.currentStatus)}}" type="{{getType(this.value, ...
1
vote
0answers
30 views

Footer load before partial

My view structure: <header> <body ng-view>(partial is loading) <footer> When I am refreshing the page for a second footer appears before partial, but I need in sequential order ...
1
vote
0answers
40 views

Confused with angular tutorial step

From https://docs.angularjs.org/tutorial/step_11 unit test section: it('should create "phones" model with 2 phones fetched from xhr', function() { expect(scope.phones).toEqualData([]); ...
1
vote
0answers
40 views

ng-options is not displayed all the time in AngularJS

I have a small problem when I load my page. Sometimes, my ng-options has blank values. I don't understand why. I can load the page 10 times without problem, but I can load the page with blank values. ...
1
vote
0answers
23 views

Can access an object via console during debugging, but code throws an error

This problem is honestly the strangest thing I have encountered. I have no idea whether or not it's able to be reproduced, so I'm just asking for some input on possible causes. The code is ...
1
vote
0answers
610 views

Sidebar transition using AngularJS using scope.apply not working

I have 2 sections of a page 1. Sidebar menu 2. Page content When I click a button on the page content the slide bar menu should slide out. I am trying to achieve this using ngClass of Angular JS. ...
1
vote
0answers
123 views

Adding Multiple 'require' Options for Angular Directive

Usually in Directives, I use require: 'ngModel' if I want to pass the scope to it. This works fine. But I am now creating a directive that creates 5 different HTML elements each with different ...
1
vote
0answers
206 views

AngularJS ng-repeat - http.gs retrieving data, but not displaying

I am new to angular and trying to integrate it within my application. I am attempting to use a simple $http.get to a .JSON file, which displaying the matching contents in a ng-repeat Here my get: ...
1
vote
0answers
115 views

Disable ng-click on certain conditions of application for all types of element

In my application I've binded several elements with ng-click directive like below <a ng-click="DoSomething()"/> <button ng-click="DoSomethingElse()">xyz</button> <span ...
1
vote
0answers
42 views

element directive cannot display on page when call from other directive

I am getting a problem while calling colors element directive in draggable directive. when i call colors directive it add "" string in html. I want a select element populated with colors array ...
1
vote
0answers
89 views

element.replaceWith(otherEl) makes directives loose functionality

At a specific event, in the link function, I change the view html, like this: var html = $templateCache.get('otherTemplate')[1]; var dom = angular.element(html); element.replaceWith(dom); ...
1
vote
0answers
169 views

Use Photoswipe with AngularJS

I am having a problem with Photoswipe and Angular. Basically what I'm doing is get the images from my server using $http.post and then pushing those objects into my array of images, then I'm ...
1
vote
0answers
448 views

Cant integrate facebook login to angular app using ngFacebook

Somehow I am not able to integrate facebook Login to my angularjs app, though I feel I am just loosing a minor mistake which I cant point out and thus you geeks might be sureshot help! I have used ...
1
vote
0answers
22 views

Using attribute containing 'start' in a directive doesn't work

I was trying to pass variables to a directive but I kept on running into issues with one of them constantly returning an 'undefined' value, even after reordering. It seems at first as though Angular ...
1
vote
0answers
54 views

AngularJS - multiple use of component with same controller, using different data

I have a simple component that is being included using ng-include. The controller of the component is assigned in the included HTML. I would like to use the same component twice (or more) but load ...