Questions tagged [angularjs-scope]

In AngularJS, a scope is an object that refers to the application model. It is an execution context for expressions.

In AngularJS, a scope is an object that refers to the application model. It is an execution context for expressions. Scopes are arranged in hierarchical structure which mimic the DOM structure of the application. Scopes can watch expressions and propagate events.

All scopes are children of the top level $rootScope using prototypical inheritance. A new child scope is created every time a directive in the DOM is configured to do so.

Common pitfall: using scalar variables on the scope within directives that create a new child scope (such as ng-if, ng-switch, ng-repeat, ng-include, ...) and not being able to reference them, due to the prototypal nature of JavaScript (own copy of variable is created in the child scope).

Useful links

8949 questions
2
votes
2 answers

Global parameter in ui-router

I'm using ui-router in AngularJS like this: .state ('browse.category', { url: "/:category", templateUrl: "views/browseCategory.html", controller: function($stateParams, $scope) { $scope.params = $stateParams; } …
Jordash
  • 2,926
  • 8
  • 38
  • 77
2
votes
1 answer

AngularJS / jQuery - How to append some properties of the $scope object in a jQuery event handler

I got a problem. I try to append some properties of the $scope object in a jQuery event handler. Here is my code: .controller('dashboard', ['$scope', function($scope){ $( window ).resize(function(){ $scope.device = ($(document).width() >…
PikaCool
  • 57
  • 1
  • 6
2
votes
1 answer

onsen dialog have limited access to parent scope

I'm looking for some help on using onsen-ui's dialog component. It seems to be a scope issue. In my HTML file, I have a dialog template looks like this.
X.Jia
  • 23
  • 2
2
votes
0 answers

AngularJS - Best way to share resolve dependency data with nested controller

I have an existing AngularJS route with data from an API that is injected into the page controller (PrimaryController) using a route resolve (myDependency) from ngRoute. I'm adding more functionality to this page that I'm encapsulating in a…
Alex Ross
  • 3,729
  • 3
  • 26
  • 26
2
votes
2 answers

what will happen to child scope if its parent scope is destroyed

I want to ask if the parent scope destroy, does the child scope will also be destroy? I ask this question is because i'm using the ngdialog to create some modal dialogs. There are 2 dialogs, A -> B, we can open dialog A from a web page, and dialog…
huan feng
  • 7,307
  • 2
  • 32
  • 56
2
votes
2 answers

How to set a base URL for HTTP calls and image loading with AngularJS

I've been searching and so far I couldn't find a way to handle the following situation: I'd like to have one variable that represents my domain, something like http://example.com/myserver/. Anything that I would want to access is sublocaled in that…
2
votes
2 answers

AngularJS Routing based on Checkbox Selection

I am trying to learn Angular JS with an HTML Sample. I would like the user to fill out some basic information, and based on the checkbox they select, it will load a form page using the UI Routing. It will generate links to navigate the page…
2
votes
1 answer

Angular populate Bootstrap modal form from controller data

I am trying to populate a modal form with data passed in from my controller. The data being displayed is always NULL, even though I have populated the data in the controller. I have been trying to work this out and have tried a few different ways…
user142617
  • 386
  • 2
  • 7
  • 18
2
votes
2 answers

Angular JS: Increment a Counter in a Service From Controller

I'm trying to fetch a value from an API inside my service for a counter, and then increment on that counter inside my controller: service angular.module('app') .factory('MyService', MyService) function MyService($http) { var url = 'URL; return…
realph
  • 4,481
  • 13
  • 49
  • 104
2
votes
2 answers

Remove (splice) value from one scope/ng-options, while maintaining values in another

I have a dropdown list populated by one scope and the same list displayed using another scope. When I select something from the dropdown I want to hide/remove it from the display list, but keep the full list in the dropdown. I have a JS fiddle…
crowsfeet
  • 203
  • 1
  • 4
  • 16
2
votes
2 answers

Update angular model after 60 seconds

How do I get my model to update automatically after 60 seconds? I have an array in $scope.tweets that contains a list of tweets. I would like $scope.currentTweet to pop a tweet off the array every 60 seconds. Is there is a particular way to do this…
Amin Shah Gilani
  • 8,675
  • 5
  • 37
  • 79
2
votes
0 answers

AngularJs: Uncaught ReferenceError: $scope is not defined in debugger mode

I have the following code: Html
{{message}}!
AngularJs var myApp = angular.module('myApp',[]); function MyCtrl($scope, $http) { …
2
votes
1 answer

angular ng-repeat dosen't wait for scope

html
{{item.week}}
script .controller('TimesheetMainCtrl', function ($rootScope, $scope, $window) { dpd.timesheetold.get(function (result, err) { if (err) return console.log(err); …
2
votes
1 answer

AngularJS ES6 ui-grid directive scope, ng-click dont work

I have a chain directive with angularJS and ES6 and want to use ui-grid. The grid is shown with the correct columns and data, thats fine. But ng-click don´t work in the cellTemplate. Nothing happens. Also i try to check the grid object with…
2
votes
3 answers

Convert Javascript object to String in Angular JS

I'm new to angularJS and i'm having some issues with the below code. Basically what i'm trying to achieve is to search the spotify API for a term and retrieve the first playlist given to me, then grab the URI of the playlist and concatenate it to an…
ThallerThanYall
  • 197
  • 2
  • 14
1 2 3
99
100