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

0
votes
1answer
119 views

Bootstrap select picker with ng-repeat is not working for JSON object

I was using Bootstrap select for search and multiple select but the problem is when i am using $scope object in ng-repeat for options it's not working . I have given my codes below . <select name="...
0
votes
1answer
17 views

How to implement 'Open on focus' to Angularjs calendar?

I am new to Angularjs, how can I add open on focus implementation (similar as Microsoft Windows 7 calendar) to my calendar as given below where we using Angular material version1.0.1. We decided not ...
0
votes
1answer
20 views

Angular.js can't focus after state changed

Our UI is a little buggy. When we load the page the first time everything works perfectly. When we switch - in our case restaurants - the model is update and we can't focus the input fields. Any idea ...
0
votes
1answer
13 views

Angular: Access variables from outside scope of ng-repeat

I am having issues accessing variables (attached to $scope) inside ng-repeat loop. My ng-repeat is as follows: <div class="row" ng-repeat="Message in Messages"> <p>{{ Message.Sender ...
0
votes
1answer
19 views

Parent and child scopes in angular

Can anyone please provide me with simple examples to understand parent and child scopes in angular better? I have tried the following but it prints hello {{person}} as output. <!DOCTYPE html> &...
0
votes
0answers
2 views

it is displaying angularjs binding expreesions on browser

/// var app=angular.module('demo',[]); app.controller('myController',function($scope){ $scope.message="welcome to angular ja"; });
0
votes
1answer
23 views

Angularjs:open on focus feature to my calendar

How can I add open on focus feature(similar as Microsoft windows 7 calendar) to my calendar as given in demo where we using angular materiel version1.0.1, please help me with solution. Thanks In ...
2
votes
1answer
27 views

Reuse function Angular 1

Let's say I have 2 lists of items: available items and associated items. now I want to write a search function that calls API methods that do the search for each list (different methods). I want to ...
0
votes
2answers
714 views

Trouble initializing a $scope variable with ng-init in my HTML

I am trying to initialize $scope.selectedModel to model1with ng-init. However, the following HTML fails to accomplish this: <div class="productImage"> <div class="imageGallery" ng-init="...
0
votes
1answer
32 views

Angular 1.5 component issue - how to 'reset' a function coming from its controller when changing to another state?

I have an Angular 1.5 component with a controller (which uses controllerAs syntax), where I wrote a function adding additional css class to the component element if a certain html element exists in ...
0
votes
1answer
16 views

Angular UI Bootstrap 2.3 Modal is not rendering sightly parameters

I am having a compatibility issue with Angular UI Bootstrap Modal and sightly Parameters. When I try to render the sightly parameters inside the Modal the modal does not render the value in the ...
3
votes
2answers
39 views

Understanding Hierarchy of the $scope in AngularJS?

When I create a object and navigate through the _proto__ property of it I get to know that it has been inherited from Object Now when I create a new object and inherit the obj object, then I get the ...
0
votes
0answers
32 views

Angular use variable before running rest of the code

I know the problem is the order of execution, the scope fires async and loads the data after the rest of the code has been processed. I have a httpGET that gets the information from a web service and ...
1
vote
2answers
46 views

Issue with Isolated scopes in angular

I am trying to run this program and I see no output. Can you please let me know what I am missing here. Thanks in advance. <html> <head ng-app="myApp"> <title>Test</title> &...
0
votes
0answers
20 views

Reload the angular view from controller only once

I am trying to go to a view and then reload that view from the controller exactly once. What I have done looks like this. function checkForReport() { if ($rootScope.reportCounter) { ...
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 ...
106
votes
11answers
86k 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&...
0
votes
1answer
21 views

How to write <script> in $scope style

I'm implementing google map into my ionic app, and I have a script in my index.html, which, will only allow the map works in the index.html. But I need my map in my templates file route.html instead, ...
0
votes
0answers
37 views

AngularJS Scope Function Call [duplicate]

I have an angularjs controller. I added a function to it's scope, since this function is called from the html. $scope.search = function() { //do something }; But I need to call this function ...
4
votes
3answers
3k views

Using $emit in angular 1.5 component

I am using angular 1.5 component and need to call function in parent controller from when $emit in child component. How we can do this? Example: (function (angular) { 'use strict'; ...
0
votes
1answer
41 views

String Concatenation in Angular

Simple question, but struggling to find an answer. HTML <div class="col-sm-5"> <input type="text" class="form-control" placeholder="key" ng-model="main.key" ng-change="updateJson()"> &...
1
vote
1answer
1k views

AngularJS: How a Directive without a Controller can work

just reading a write up from this link http://weblogs.asp.net/dwahlin/creating-custom-angularjs-directives-part-6-using-controllers it was hard me like novice in ng to understand their code sample. ...
0
votes
1answer
14 views

Utilize current controllers scope and parent controllers scope in $scope.$on

I am currently broadcasting to a child scope(from one parent controller to a child controller). In the $scope.$on app.controller('myCtrl') $scope.$on('broadcastName', function(e, d){ ...
8
votes
7answers
11k views

AngularJS animate image on src change

I have an AnuglarJS app, where I load/change some images from a webservice... Controller .controller('PlayerCtrl', function($scope, programService) { .... programService.refresh(function(...
0
votes
1answer
26 views

AngularJs $http.post() does not send data if i sending data is huge

AngularJs $http.post() does not send data if i sending data is huge I want to store one task to my db. If amount of data in assignedMember is more than 175 it will not send got 404 error but If ...
0
votes
1answer
29 views

How to access objects returned by a service from within controllers

I have a service that returned array of objects to a controller , the console showing the below response : Array[0] 0 : Object first_name : "Emi" id : "255860959988416847" last_name : "Hauritz Seino"...
2
votes
2answers
50 views

checkbox selected true by using condition

I am new to Angular this is my data $scope.checkgoogleKeywordIdsData=[ {"AdGroupId":"37446130209","Id":"41941982"}, {"AdGroupId":"34657098157","Id":"1275289507"}, {"AdGroupId":"37446130209","Id":"...
0
votes
1answer
16 views

Angular Directive - Scope Breaks after adding directive

I am going through this tutorial. https://code.tutsplus.com/tutorials/mastering-angularjs-directives--cms-22511 For some reason when I add my directive. myPerfectDirective It breaks the scoped ...
0
votes
1answer
54 views

how to access a variable out of function

I need batchdata:{course_name:"xyz",batch_fees:"1200",---,course_id:"xyz123"} to sent database but I'm having problem to send course_id along with batchData for that I'm taking course_id from ...
1
vote
2answers
50 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 ...
1
vote
3answers
222 views

what are the directives that support one way binding in angularjs

In angularjs what are the directives that support oneway binding. ng-model supports two-way binding Does ng-bind,{{}} expression supports one way binding ?
0
votes
1answer
37 views

Hiding navbar based on current path with AngularJS ($scope vs. controller as syntax)

I'm working with the Inspinia Admin Theme (AngularJS Version) and have the following Problem. I'm trying to show or hide the navbar based on the current path. The Problem with my first approach (...
0
votes
1answer
16 views

From run block can i able to call angular scope function inside another controller instead of $rootscope

I need to call angular Scope function inside some controller from runblock. can i able to call the function or else need to use rootScope or $scope.apply. First method: myAPP.run(function ($...
4
votes
1answer
13k views

AngularJS $scope.variable is undefined

Pardon my newbiness but I can't figure it out. Why is my $scope.new_prompt undefined when clicking submit form? I can see the variable being updated as I type (in <p>{{new_prompt}}</p>) ...
-1
votes
2answers
45 views

scope into variable - Javascript

I have a text box that passes the user input into a $scope. I need to pass this further along into a firebase query, but im having trouble getting the variable to register the input stored in $scope. ...
836
votes
14answers
352k views

How to access the $scope variable in browser's console using AngularJS?

I would like to access my $scope variable in Chrome's JavaScript console. How do I do that? I can neither see $scope nor the name of my module myapp in the console as variables.
225
votes
4answers
85k views

$rootScope.$broadcast vs. $scope.$emit

Now that the performance difference between $broadcast and $emit has been eliminated, is there any reason to prefer $scope.$emit to $rootScope.$broadcast? They are different, yes. $emit is ...
0
votes
2answers
55 views

Implement Authorization in AngularJS

I want to implement authorization in AngularJS. In my project which is some kind of social media, different roles or even same roles may see a view file differently. For example imagine we have two ...
768
votes
6answers
598k 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 ...
1
vote
0answers
33 views

Get ngModel value from $scope without it's exact name

What I need is to get value of my model from my directive <input type="number" placeholder="must be numeric" class="form-control" name="meter_count" ng-model="sllr....
12
votes
3answers
61k views

Why is Angularjs ng-pattern not working with the following regexp?

For some reason the initialized value doesn't appear in the field, but the second field without the ng-pattern does work. any ideas? angular.module('app', []).controller('MainCtrl', function($...
0
votes
1answer
21 views

add a new property in ng-model object after it's been changed via ng-repeat

I wanted to add a property "discountRate" to ng-model object after the object is changed within a ng-repeat block. Example 1 Example 2 After selecting an option the ng-model is updated as expected. ...
0
votes
2answers
31 views

View is not refreshed after $scope is updated in Firebase promise

I am using Ionic Framework and Firebase is my BaaS. Controller: .controller('ProfileCtrl', function($scope, AuthService, DatabaseService) { console.info('** ProfileCtrl **'); var user = firebase....
0
votes
1answer
25 views

Rendering part of component outside of the component itself

I have JSFiddle like this: https://jsfiddle.net/ownvjjow/ Basically the problem is that I'd like to render some part of component x outside of the element(x) itself. Like in the outer scope, but ...
1
vote
0answers
35 views

Is it better to use directive with or without isolated scope for a custom input field validation directive? [closed]

I have a directive for checking form validation. Requirements are Check if ngModel value is empty. Call a function only if all values are filled. Also set a variable true or false based on the ...
1
vote
2answers
48 views

Interpolation in Angular JS

I am trying to understand Interpolation concepts in Angular JS and I have written this code. I am trying to enter a text in input box and based on the template in text area tag it should replace the ...
0
votes
0answers
89 views

Angular Directive Transclusion Scope Issue

I am creating a custom directive as follows: <directive-a attribute-a="customData" attribute-b="customKey"> <!--Transcluded Content--> </directive-a> The scenario is as follows: ...
831
votes
13answers
392k 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="...
0
votes
1answer
31 views

AngularJS ng-click is not working with $scope variable

Can't get my bottom div to show. tried all the suggestions in SO from this year. Added a variable to $scope, tried $scope.apply(); , etc. <nav class="navbar navbar-default navbar-fixed-top" ...
1
vote
4answers
5k views

Calculate average from list of values in JSON

I have a simple ng-repeat that displays a list of values (financial income). How can i calculate the average from this list? <div ng-repeat="data in MyData"> {{ data.income }} </div> &...