In AngularJS, a scope is an object that refers to the application model. It is an execution context for expressions.
0
votes
0answers
21 views
$scope variable doesnot bind with view after getting updated
I have a $scope variable isAuth that is a boolean which will be true when user signs in. And I use this variable to show a footer using ng-hide. I have a route definition with $routeProvider service ...
749
votes
6answers
580k views
How to 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 ...
0
votes
1answer
20 views
View No Longer Updating Immediately in Efforts to Clean Up Scope Soup
I've fallen victim to self-imposed $scope soup and am taking steps to correct this. I'm adopting some of the methods written about by Josh Carroll in his article here:
http://www.technofattie.com/2014/...
1
vote
0answers
18 views
function on $scope vs function on $window
We can create functions at scope level. If i have a controller todoCtrl then if i define a function inside the controller scope that method will reside inside the controller scope.
For example,
$...
0
votes
1answer
17 views
I wrote an if condition inside angularjs controller, not working properly
I wrote this if statement by myself to differentiate USD and LKR, the values are not coming properly. Is this if condition correct?
$scope.$watch('currencyVal', function () {
...
8
votes
2answers
9k views
angularJS $broadcast and $on
is there a way to make the $broadcast propagate the variable to the $on during initialization phase?
<div ng-app='test'>
<div ng-controller='testCtrl'> <span>{{testContent}}</...
1
vote
2answers
30 views
Angular JS - NG-Repeat with filters and groupBy
I am building a dashboard to display ogoing and closed issues. I got everything working with angular's ng-repeat with filters and grouped by date. Here is a quick sample of what I got so far:
<div ...
0
votes
1answer
38 views
How to capture the error code in $q deferred promises
I have planned to create a custom alert message according to the error codes.
So I have to get the error codes while sending the request to the server and getting an response from the server.
500 - ...
1
vote
2answers
862 views
how to use uibmodal with a scope sub parameter?
Using angular-boostrap's uibmodal, I want to give my modal a namespaced set of scope parameters to work with. I need these scope parameters to live in my parent to passed on to other controllers, but ...
0
votes
0answers
42 views
not getting textbox value using ng-click
I am getting an undefined when getting the value of the textbox which i weird because i have done this perfectly in my other controller. I am missing something or what
app.controller('expandCtrl', ...
0
votes
0answers
22 views
Update part of model from scope selected object
Ok, I have model with one property(provider) as object. It can change at all.
There is example, where I change provider. There can be any parametrs, image can has dpi, json can has another parametr.
...
0
votes
2answers
33 views
Implement a single method or use $scope.on and $scope.emit in AngularJs that will call the same method in multiple controllers without a service
I know similar questions has been asked in the past, but I hope to get a better understanding to my specific issue.
I have multiple controllers managing the view of a single page. The main reason ...
0
votes
2answers
28 views
AngularJS function in controller and factory not working when separated
angular.module('myFirstApp')//
//begin controller
.controller('myController',function($scope,$http,personFactory){ //hi im controller i need to call the http service from the factory
//...
0
votes
0answers
12 views
Response for preflight has invalid HTTP status code 403- ionic app error
Hey getting error mentioned above. It is running fine on mobile but not on browser.preflight has invalid HTTP status code 403. Backend developer says he has coded everything perfectly at the backend. ...
2
votes
2answers
34 views
ngModel undefined when using directive - Angularjs controller
My ngModel is undefined when using the ngPattern directive. If I remove ngPattern, the ngModel works as expected. See plnkr.
Note how vm.condition does not show when typing a value in the text box, ...
0
votes
0answers
20 views
Cannot modify variable out of scope [duplicate]
No matter where I place the variable. The changes do not reflect outside the loop.
$scope.getSubsByEmail = function(email) {
var userNotFound = 0;
var arr = []
SITES.forEach(function(site)...
9
votes
2answers
10k views
Using ng-show to expand nested list on click
My code - Plunker
I used ng-repeat to render my nested list.
the list built in a way of a folder which is always displayed
and files which are displayed when parent folder is clicked.
The problem ...
0
votes
0answers
21 views
Global Exception handling in angular js using promises : Exception handling: $q promises not catching Error code
I have plan to implemented the Err handling service globally for my existing application. I am not send the error code from server. so i have plan to implement the Error code in angular by using ...
0
votes
0answers
12 views
angularjs datatable is not working while using datatable='ng' searching and pagination
My Controller
.controller('BankaccountViewController', function($scope, $uibModal, $log, $location, $routeParams, $timeout, DTOptionsBuilder, BankaccountService) {
$scope.dtOptions = ...
0
votes
0answers
35 views
How to find a substring count with Javascript and then pass into AngularJS
Essentially what I want are numbers that I can pass into HTML based on a the number of times substring is matched from a response body.
I understand the best way to get that number is through regex. ...
103
votes
11answers
83k views
Controller not a function, got undefined, while defining controllers globally
I am writing a sample application using angularjs. i got an error mentioned below on chrome browser.
Error is
Error: [ng:areq] http://errors.angularjs.org/1.3.0-beta.17/ng/areq?p0=ContactController&...
-2
votes
1answer
28 views
How to use Ng-repeat within controller not in view
According to the below json. If I call this scope in controller, I am getting output :
[{"code":"USD","value":"0.00670000"}].
I want to get only value but within controller I want to do. Does ...
0
votes
1answer
49 views
How to show data one page to other in angularjs
I need some help from you guys I am new in AngularJs, I have code there is too long code thats why I upload doc file, please check it below link, Using the code snippet below I'm authenticating ...
0
votes
1answer
32 views
how to get multiple object value in angularjs
i have following code i have more then one object in return how to get these please help check below code and image file
.then(response => {
this.jobCategories = response.data;
...
1
vote
1answer
25 views
Project structure for large Angular application?
I am new to angular js
I want to create my project structure like this
- APPLICATION
-index.html
-app.js
-modules
-core
-controllers
-directive
-views
-core....
1
vote
1answer
33 views
angular js redirect to view
I have below code
code to render /result content whenever the defaultview function is called using the $route service
angular.module('myapp').controller
('ResultController',['$route',function (...
1
vote
1answer
31 views
Changing $scope.variable in $scope.$on function does not update view
I want to listen for route changes and update a $scope variable to reflect the current route in my menu (md-nav-bar):
$scope.$on('$routeChangeSuccess', function(event, current) {
$scope....
1
vote
1answer
68 views
Angular JS two way binding not updating when using button
I'm a bit of a newb at angular and having a persnickety issue. I am trying to update a variable bound to a div in my controller with a function, that is called when a button is clicked. (The function ...
0
votes
1answer
19 views
$http POST angular-Submit constant public key at the time of login
I need to submit public key with constant key value, along with username and password at the time of login.And also to redirect it some other page in ionic app- href="#/tab/abc", if login is ...
0
votes
2answers
34 views
How can i toggle directive without using scope declaration
I need to watch an attribute from a directive, and have that toggle a function whenever the value is true, this works the first time you click it, but i then need to reset the value of the ATTRIBUTE/...
0
votes
1answer
42 views
Controller and directive variable's scopes
I'm new to AngularJS. I've started learning it from basics and began doing the simplest examples and the custom ones. Recently I've found some strange behavior of AngularJS.
I have the following code ...
1
vote
2answers
42 views
Why ng-repeate object not getting updated?
This is the function which load listings from server. Initially listings are displayed but when gets null response on applying filter, it still shows previous result and not clearing previous listings....
1
vote
0answers
40 views
AngularJS ng-class doesn't update
I've got a problem with ng-class.
This is a piece of my controller
export class UIController
{
public static $inject = [];
public commands: Array<string> = ['showMap', 'showGantry', '...
0
votes
1answer
24 views
Work with ng-disable when required field is empty
I'm having some problems to put ng-disable to work, so, I have this div:
<div>
<p>{{ message }}</p>
<div >
<input type="number" id="field1" placeholder="field 1" ...
1
vote
2answers
34 views
AngularJS 1.5 - How to Set Two Way Bindings on Component
Directives in Angular 1.X are set to have two way binding by default. Components have isolated scopes by default. I have a view that looks like:
<div class="my-view">
{{controllerVariable}...
0
votes
1answer
31 views
Why does ng-show=“true” not reference $scope.true?
If I set $scope.true = false;, I would expect an Angular expression that references true to evaluate as false. Similarly, I'd expect $scope.false = true and $scope.undefined = true to yield similar ...
0
votes
2answers
49 views
How to add the values which is present inside the array (or) Json?
I been wondering if someone fixed my issue. my code looks like this.
var app = angular.module('myApp', []);
app.controller('myCtrl',function($scope){
//Adding New Check# and Check amount Text ...
0
votes
3answers
29 views
View form surroundet with ng-if is clearing model
I'm trying to send some data from a form to my controller. Surrounded in the template file with an if. So my working example (without ng-if) is:
View
<form ng-submit="activate()">
<div ...
0
votes
1answer
32 views
User input not binding from $scope.$watch
Just getting started with Angular and I've spent the last 2 days trying to figure out how to bind data from a new search through a service. I had the search working before with the following code ...
4
votes
1answer
7k views
How to use SASS in Ionic framework?
I am trying to use SASS in my project. I open this link and follow all command. I create a project and setup SASS.
http://learn.ionicframework.com/formulas/working-with-sass/
I got this directory ...
0
votes
2answers
2k views
AngularJS +1.5 How can a Parent controller pass data to a component Controller
I have a component like:
Check Plunkr Example ( Updated and Working with the solution :) Thanks )
my-component.js declaration
(function() {
'use strict';
angular
.module('app')
....
0
votes
2answers
1k views
ng-init vs function in controller, which is better practice when using $parent?
I have a Bootstrap modal which corresponds to a ng-repeat list. I would like to access the ng-repeat scope data from its parent, which contains the modal. I do this so that when the modal button is ...
813
votes
13answers
382k views
What is the difference between '@' and '=' in directive scope in AngularJS?
I've read the AngularJS documentation on the topic carefully, and then fiddled around with a directive. Here's the fiddle.
And here are some relevant snippets:
From the HTML:
<pane bi-title="...
2
votes
1answer
111 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';
myApp.controller('...
-1
votes
1answer
32 views
Insert all data from front end to database using angularjs [closed]
Im very new to angularjs. I have some sort of data in in my html file. I need to insert all data from front end to database. Does anyone provide me some coding for that?
1
vote
2answers
35 views
IONIC APP- get device id for post service($http.post)
I'm trying to get the device id getUUID at the time of app login along with username and password. Is the right way to get device id and post it to the server for login.
controller.js
....
0
votes
0answers
18 views
init variable in ng-repeat's root scope
I want to know how can I initialize a variable in the ng-repeats root scope as I explained in the below block diagram. I should able to access the same variable in the filter that i am using as part.
...
51
votes
4answers
41k views
How to clear or stop timeInterval in angularjs?
I am making a demo in which I am fetching data from the server after regular intervals of time using $interval Now I need to stop/cancel this.
How I can achieve this? If I need to restart the process,...
0
votes
0answers
55 views
Tr td ng-repeat angular
Using angularjs1.x My json is
[{
"headerid" : 1,
"datatype" : "label",
"fieldname" : "food",
"maxval" : 10,
"minval" : 20,
"parentid" : 0
}, {
"headerid" : 2,
"...
0
votes
2answers
21 views
Passing value in function properly in AngularJS
I have the following function which takes variable description as parameter
$scope.relsingle = function(description) {
console.log(description);
var url = $scope.url+'/api/descrelation?limit=...