In AngularJS, a scope is an object that refers to the application model. It is an execution context for expressions.
-1
votes
0answers
3 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 using $...
0
votes
6answers
30 views
$scope with property says undefined
My controller
App.controller('Ctrl', ['$scope', function ($scope) {
$scope.user = {};
$scope.view = function () {
console.log($scope.user);
console.log($...
0
votes
1answer
8 views
Angular form to pristine when for is in original state
I have a form with preset values from an object in scope. When I modify a form field for instance the name field and change it from Bob to Bobby the form is now dirty but if I delete the "y" and the "...
1
vote
0answers
19 views
When ReactDOM.render() is called within Angular1.x link step, does the state changes still matter?
I am working an AngularectFrenkenstin, so I wonder does a call of ReactDOM.render() means a total replacement of everything within this component? Does state changes on the data set are still retained?...
1
vote
2answers
21 views
How can I pass a function with argument to a component?
I want to pass a function from the parent component to the child component and give it an argument that has also been given from the parent component to the child. (showOrHideSub="item.showOrHideSub(...
0
votes
0answers
14 views
$rootScope seemingly updating too slowly in an asynchronous call
I'm attempting to achieve a sliding left/sliding right effect (like navigating a flow in an app) with ui-router and ngAnimate.
To achieve this effect, I am adding a css class on the container of the ...
0
votes
2answers
17 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
10 views
Exception when exposing $window.print on angular scope
I'm exposing $window.print() on scope like so:
$scope.print = $window.print;
However, this results in an exception:
angular.js:13642 Exception message: Illegal invocation
I need to call print ...
-1
votes
0answers
26 views
AngularJS accessing repeat variable from include
Okay so here it is... I found a typo in my code! FFS!
-_- Apologies for wasting your time. Thanks anyway for the help.
0
votes
2answers
17 views
Event binded to dynamically generated HTML get called automatically
I am trying to bind event to dynamically generated html in AngularJs controller, but I can't. I found following code snippet
var div = angular.element("del-" + input.name);
div.bind('onclick', $scope....
0
votes
1answer
20 views
scope().$apply(); isn't working in IE10
My JS:
function redirect(aPath) {
var app = $('#divMain').injector();
if (aPath == app.get('$location').path()) {
app.get('$state').reload();
}
else {
app.get('$...
0
votes
2answers
47 views
rootscope vs scope angularJs
I am new to angularJs and I need your help.
I have the following example where I am trying to do an action on an element on the parent page from the inner page but I do not understand why it behaves ...
0
votes
2answers
31 views
how to open dropdown in angular js?
can we open the dropdown when it focus using tab keyword .I want to open the drop down while using tab navigation .
Example if I am in input field (focus to input field ) then if I press tab focus ...
0
votes
2answers
41 views
Why directive is not calling my controller method?
Directive is not calling my controller method. Following is my code:
Controller:
exports.controller = ['$scope', function($scope) {
$scope.addParamter = function () {
console....
0
votes
0answers
9 views
Angular boostrap two apps causes infinite digest error
Specifically the error I get over and over (infinite loop) is this:
[$rootScope:infdig] 10 $digest() iterations reached. Aborting!
Bootstrap code (from inside of body):
<body>
<...
0
votes
2answers
32 views
Get selected value in angular js
I am new to angular.I was making a simple demo for select in which I will add new select according to current value selected. I am usig dynamic value for options and for model as well. I am not able ...
0
votes
0answers
15 views
Multiple models inside directive
I get a problem with my products-totals directive. When I'm changing a model value this one is not updated on the view. If I want it, I must change the model value of scope.$parent (like my comments ...
0
votes
2answers
28 views
Controller data not passed to directive
I started looking into angular and cannot seem to figure out why my data is not passed to my directive. I have code here: https://plnkr.co/edit/ONwYevQ4NbvBVjTwARHl?p=preview
My Code:
app.js:
var ...
0
votes
1answer
34 views
Getting value of ng-change field in my angularjs controller
I have this line in my view:
<input placeholder="Search" type="text" ng-change="searchChange()" ng-model="mySearch" ng-model-options="{debounce: 1000}">
And then inside my controller I have:
...
-1
votes
2answers
26 views
I want to use a scope variable as part of my javascript's onfocus function's argument
<input ng-show="showFolderNameInput"
type="text"
name="folderName"
ng-model="folderName"
style="margin-left: 5%; width: 90%;padding-left:5px;"
placeholder="{{...
0
votes
2answers
18 views
AngularJS - My error messages aren't updating when their trigger variables are changed in the scope?
I'm pretty new to Angular so this is probably a really simple question with a really obvious answer, but I haven't been able to work it out from reading through similar posts so I figured I'd ask here....
0
votes
0answers
17 views
Window Infinite Scroll in Angular
I had implemented infinite scroll directive its working fine on scroll.
Problem :- Its getting trigger once the state change that means infinite scroll method is trigger one more time when page gets ...
0
votes
1answer
15 views
Angular: How $watchCollection works in this case?
Below is the code where we are using $watchCollection
$scope.$watchCollection(TwitterDashboardService.getSelectedList, updateList);
As fas as I know $watchCollection observers the changes in a ...
0
votes
2answers
30 views
Controller-independent stepper functions
I have an AngularJS project, and I'm using a modified version of md-steppers, whose interesting functions boil down to this:
var enableNextStep = function () {
//do not exceed into max ...
0
votes
2answers
37 views
Angular data from service not showing on the frontend
Ive made 3 views and linked them to a single controller. In my controller, I am calling a service which I have made which makes a network call and gets some data which I am supposed to display on the ...
-2
votes
3answers
45 views
Add and delete items in array issue using angularjs
when user click delete button in first list i need to delete the item and add same item in second list.
when user click Add button in second list i need to delete the item in second list and added ...
-4
votes
0answers
56 views
AngularJS page shows variables instead of contents
I am totally new to AngularJS and when I bought an AngularJS web app script online, the pages look fine on browser with proper HTML, but when I do a "view source", below code is what I saw (a 404 Page ...
0
votes
1answer
26 views
“controller as” with isolate scope in directives not isolating
I'm trying to learn to build custom directives in AngularJS. Presently I am using AngularJS 1.5.8.
I am trying to create an example of a directive with an isolate scope where the controller scope is ...
1
vote
0answers
14 views
Passing a binding to transcluded scope in component
In Angular 1.5, I want to pass a binding from a component into the (multi-slot) transcluded scope - for a reference in the template (in either one spesific or all of them - no either way is fine).
...
0
votes
2answers
48 views
ngRepeat based on the selection
I want to change the number of elements to the number given by a select box.
My code:
index.php
<select class="form-control-static" ng-model="fieldSelect" ng-change="showSelectValue(fieldSelect)"&...
0
votes
2answers
39 views
How to destroy scope manually in angularjs if element is removed from javascript?
I am inserting angular template to element.
Consider following example,
<p>
<c ng-controller="ctrl">
...
</c>
</p>
if I remove c from javascript.
What ...
0
votes
2answers
21 views
AngularJS acces controllers $scope inside state onEnter function
I have a state inside my angular .config $stateProvider and I want the onEnter method gain access to the controllers $scope of the state.
My state is declared like this:
.config(function($...
0
votes
0answers
16 views
Undefined two-way binding object to save in angular
I posted my code below. In a modal I have a editDependent as model in a modal div which is in a page employee.html which is routed in a inner div ui-view. How to perform the two-way binding on the ...
0
votes
1answer
24 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']
}...
1
vote
1answer
29 views
Angular JS render variable in scope function to view and make comparison
Hi I have been using this tag to change my css style, if the condition totalAsset and sortedAsset are same
<div class="table-row" ng-repeat="x in myData" ng-click="sort()"
ng-class="{'lightblue':...
0
votes
0answers
25 views
Passing data from directive's isolated scope to a controller
I have a directive that handles cancelling/rescheduling certain tasks. Once these tasks have been updated I need to pass back the updated list of tasks to the controller that contains the directive, ...
0
votes
2answers
26 views
How can I create an array from the value of the same directive on different pages in Angular JS?
I am using Angular 1.5.7 and am trying to see if I can push the value of an attribute within a directive used on several different pages to an array that lives in the controller.
I am pretty sure ...
0
votes
1answer
20 views
How to use Jasmine to test Angular App's Service
I'm practicing Angular and automated testing.
I made a simple app to tell the user the strength of their password. Originally everything was within the PasswordController and used $scope. Then I ...
0
votes
1answer
33 views
Loading multiple modules or controllers in Angular is not working
I am needing to "import" or "use" a Modal Service and my current code that works looks like this
angular
.module("deviceManagement")
.controller("DeviceDetailCtrl",
["$scope",
"$...
0
votes
2answers
24 views
Ng-repeat delete and Edit icon visibility issue on outside click
In ng-repeat I have a list of items and each item I have a Edit and delete icon like below,
Item1 (Edit) (Del)
Item2 (Edit) (Del)
Item3 (Edit) (Del)
Item4 (Edit) (Del)
When user click edit I changed ...
0
votes
1answer
12 views
How do I access the properties in the scope of an ng-repeated item inside of an ng-dialog specific to each item?
So I have a list of ng-repeated items, and each of these items has it's own button that calls a popup that I create using ng-dialog. I need to print the properties of the item in each pop up.
html:...
0
votes
2answers
24 views
Character limit on input text
I want to my textbox to only allow numbers and also have a character limit on it.
Currently, I have the numbers working... Now I am having issues figuring out how to limit the characters.
Here is ...
0
votes
2answers
43 views
Angularjs - How can editable data be shared between run, factory and controller blocks?
tl;dr - app.run resets $rootScope.variable's value every time I invoke an API - I need help finding a way around that.
I have an AngularJS + ASP.NET Web API setup. I need AngularJS to send a token in ...
0
votes
1answer
27 views
ES6 class calling a method within a class with bind vs call?
I have a class written in ES6 and I have a directive "action" which needs to access a controller value called "selected". This controller value "selected" is updated by another directive "grid". ( 2 ...
2
votes
2answers
46 views
Get resolve variable and pass to controller
Hi I created a model named billerModel and a route that has a resolve with a variable of billers. Now I want to retrieve and assign this variable inside my controller but I get this billerData unknown ...
0
votes
2answers
27 views
Get all input fields onblur
I made the following code (jsFiddle) to get the input of a text field:
var app = angular.module('myApp', [
'my.controllers'
]);
var controllers = angular.module('my.controllers', []);
...
0
votes
0answers
23 views
$scope.$parent's Object getting lost when accessing data from childScope
.controller('mainApp.qaModule.controller.questionVoteMeta', ['$scope', function($scope) {
console.log("Test", Object.keys($scope.$parent), $scope.$parent, $scope.$parent.questionValues);
}])
...
0
votes
5answers
47 views
Reusable functions or services in AngularJS
I am repeating same code for all the controllers.
E.g
$scope.CANCELLATION_IN_PROCESS = function(getOrder) {
return getOrder.status == 'ORDER_PLACED' && getOrder.cancellableStatus == '...
0
votes
2answers
29 views
How to send save multiple ng-options json data?
I am new to ng-options
Here I attached fiddle link http://jsfiddle.net/soumyagangamwar/htj1wy0g/
I have a JSON data in my controller
$scope.tables= [{
"label": 'table1'
...
0
votes
0answers
23 views
Custom Filter on Angular without cluttering up my controller code
I have started to need much much customization on data
Example, in my controller at the bottom I started to add in some functions, but I see that I'm going to NEED MORE and MORE ,
Seems like it ...