In AngularJS, a scope is an object that refers to the application model. It is an execution context for expressions.
4
votes
0answers
373 views
AngularFire does not update Firebase sometimes
The controller below feeds a view with a table and a form.
The relevant part of the table is:
<tr ng-repeat="obj in tab.col | filter:filterObj" ng-click="select(obj)" ...
2
votes
0answers
22 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
64 views
ng-model and form inside ng-repeat
I am creating a form for each item in my $scope. ng-model is not linking with the data on my form submit. Any ideas?
<li ng-repeat="item in favourites">
<form ...
2
votes
0answers
84 views
Custom filter overrides original data or causes infinite $digest loop
Initial Situation
TL;DR
I want to filter a nested array with a custom AngularJS filter. Unfortunately not only the data for ng-repeat are filtered but the original object from $scope too.
I have a ...
2
votes
0answers
242 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 ...
1
vote
0answers
18 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
52 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
68 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
24 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
32 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
33 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
22 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
112 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
51 views
AngularJS directive to format model value for display but hold actual value in model
In angularjs I am trying to build a directive for currency textbox which takes values (amount and currency code) from the model in scope and then apply currency formatting to it. I am really having ...
1
vote
0answers
77 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
53 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
38 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
56 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
84 views
Angular directive in ng-repeat doesn't call link
I'm fairly new to Angular and am having some trouble getting a directive to render within an ng-repeat. This is probably a lack of experience on my part so any help is greatly appreciated.
Here are ...
1
vote
0answers
44 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 ...
1
vote
0answers
161 views
Using ng-controller on form causing page refresh?
I am in bit trouble, using ng-controller in form is stopping viewscope refresh.
Html is like:
<div ng-app="App" ng-controller="GetHoot">
//data element
//dom elemet
<form id ="text" ...
1
vote
0answers
33 views
How can I set a cookie to specific path in angular js?
I m developing angularjs project. in here I create a cookie in https:// localhost:8080/private/ path. But I need to create it in here https:// localhost:8080/ . So how can I do it?
I want to set ...
1
vote
0answers
254 views
AngularJS - ngrepeat form input elements dynamically filled with default values to post
http://jsfiddle.net/9sCnC/12/#
I'm going through a json file and parsing it through ng-repeat, a button on each item opening a modal window.
In this window a form is generated with data I would like ...
1
vote
0answers
61 views
Angularjs app scope variable not available to the view
In my angularjs code below why is the IsLoggedIn and Username not available to the view. Not sure what's wrong, any help will be highly appreciated:
'use strict';
...
1
vote
0answers
73 views
directive scope not binding with $resource
I'm experiencing a very strange issue and cannot see what I'mn doing wrong...
I have a pretty simple directive:
var widgets = angular.module('widgets', []);
widgets.directive('wdgtImageThumbnail', ...
1
vote
0answers
199 views
$setPristine() does not work properly if form control has invalid data
I am trying to reset form using $setPristine().
$scope.resetDataEntryForm = function() {
$scope.dataEntryForm.$setPristine();
$scope.pr = {};
};
It works fine if all the input controls in ...
1
vote
0answers
58 views
Event with reference dom in angular directive
I have multiple dom like
<custom>sample text1</custom>
<custom>sample text2</custom>
And they will compile with transclude to
<custom><p ...
1
vote
0answers
505 views
Angularjs - ng-model undefined
I am building a rather complex directive in which I need access to ng-model on a specific element in the template which is enclosed into ng-if directive... I have a plunker and the explanation on how ...
1
vote
0answers
48 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, ...
1
vote
0answers
97 views
File upload using AngularJS and Rails
I have a model BOOK that will insert the book details through angularjs controller
Here is my view:
<h1 align="center">Books</h1>
<div ng-controller="BooksCtrl" class="container">
...
1
vote
0answers
116 views
How to trace source of $watch model updates in AngularJS?
In my multi-user AngularJS app, I have a model object on my scope. This model can be manipulated by both user input and server updates.
I have a $watch observer to track the model and update the UI. ...
1
vote
0answers
115 views
adding more than one sources of data to angular
this is what I have in my model
// The contents of individual model .js files will be concatenated into dist/models.js
(function() {
// Protects views where angular is not loaded from errors
if ( ...
1
vote
0answers
83 views
AngularJS: Accessing current object in ng-show function for recursive directive
Given the following code:
http://jsbin.com/EkIqAju/2/edit
How can I access the current object being evaluated in the showQuestion() function in the controller?
I need this to be able to validate ...
1
vote
0answers
144 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 ...
1
vote
0answers
49 views
Getting error when using µ symbol in angularjs
Getting this error i am retriving data from web sql using jaydata.
Error: Lexer Error: Unexpected next character at columns 27-27 [µ] in expression [foodDetail.FoodItem.Vit_C__µg_].
My code is as ...
1
vote
0answers
192 views
AngularJS Table dat refresh based on dropdown list value selected
Interesting to read through your AngularJS articles, especially for new learner.
Currently I am working on a project which has a senario to select parent list control to populate another dropdown ...
1
vote
0answers
563 views
Creating dynamic scope variables
I am trying to create dynamic scope variable.
Here is the json object:
{
"status": true,
"res": {
"call": [
{
"percent": 100,
"name": "150+"
}
],
...
1
vote
0answers
183 views
Passing large JSON from JSP to Angular scope
I have a i18n.jsp in which i have a large JSON declared using c:set.
`
<c:set var="Label" scope="session">
<json:object escapeXml="false">
<json:property name="submit"> ...
1
vote
0answers
101 views
$scope.user.id outside of controller
I'm using angular.js and AngularFire and using their chat example. THe point is that the user logs in, then i should set var trueRef to new Firebase("https://alfapixteste.firebaseio.com/users/" + ...
1
vote
0answers
114 views
AngularJS animating prepended $scope data
I have an array named $scope.data with some objects in it, and then I make a call and get older data and I prepend the data to the array.
TestQuery.query({start:0, end: Date.now()}, ...
1
vote
0answers
986 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 ...
1
vote
0answers
109 views
Do angular directives on the same DOM element share a scope?
If two angular directives are attached to the same DOM element do they both share the same scope? The angular documentation implicitly indicates this is the case, If so, what is the best practice for ...
1
vote
0answers
122 views
AngularJS (1.1.5): Can you cancel Directives with priority cancel
Is it possible to keep the built-in ng-click handler from firing when you have a custom ng-click directive with a priority > 0 that fires first? Or to delay the built-in one in some way?
In my case ...
1
vote
0answers
263 views
Angular JS $scope can not find element of array
I'm relatively new to Angular and have run into a problem that I can not figure out what I am doing wrong.
Things work up until I get to the edit record screen.
From the listing page(this works), ...
1
vote
0answers
362 views
Angular custom directive: Access parent scope property in linking function
I want to set the name of an event (click or touch) on a parent scope in angular as a string. On a child scope I want to use that string to bind an event with element.on.
Example:
...
1
vote
0answers
253 views
AngularJS ng-repeat not working with DatePicker controller
I can't seem to get the inlined calendar button associated with the DatePicker to work using ng-repeat on two DatePickers. They both work when I instantiate the DatePickers separately, but I wanted ...
1
vote
0answers
88 views
Scope variable in AngularJS returning undefined
I am working on a little app and I have a service that goes and gets some data and returns it as JSON. I am able to display that data in my HTML just fine. But if I try define a new $scope variable ...
1
vote
0answers
137 views
Layouts in angular
I am trying to develop a simple directive which can take a option of layout configuration.
Lets say i want to render something like this on the page
I want to render this 4 co-ordinates in one ...
1
vote
0answers
419 views
AngularJS - Share ngModel with nested directives and transcluded directives
I am trying to create 3 directives:
.directive('dirOne', function () {
return {
restrict: 'E',
transclude: true,
replace: true,
controller: function ($scope, ...
1
vote
0answers
101 views
Custom filter filter extension pattern?
I'm currently using a filter filter on an ng-repeat which includes a number of search criteria input fields and a global search like this Plunker (ignore the misbehaviour of ng-repeat, this is a ...