Questions tagged [angularjs-rootscope]

Every application has a single root scope. All other scopes are descendant scopes of the root scope. Scopes provide separation between the model and the view, via a mechanism for watching the model for changes. They also provide an event emission/broadcast and subscription facility. See the developer guide on scopes.

152 questions
0
votes
1 answer

how to change the part of url if condition will match in ui-router?

I have two kinds of states in my $stateProvider which are authenticated user access url and public access url.. I have some sort of urls in public access , the thing is i need to prevent these url to access of authenticated user and need to change…
0
votes
1 answer

AngularJS $rootScope does not like dashes in string

I want to store a date string in $rootScope but as soon as I do it throws infinite digestion errors. $rootScope.lastWeek = '2015-12-03'; $rootScope.yesterday = '2015-12-09'; Why can't I do that? EDIT: .run(function ($window, $rootScope,…
user1842315
  • 307
  • 3
  • 13
0
votes
2 answers

Angular pass input value to $rootScope variable

I have situation where I want to use $rootScope variable and update its value with the one entered in input field. I have sitauation code shortened to this DEMO: HTML:
Mindaugas
  • 1,173
  • 5
  • 15
  • 31
0
votes
2 answers

AngularJS - $rootScope variable initialization fails

I'm trying to initialize a $rootScope array variable (arrayX) and use it in a $rootScope function in the same controller (controllerA). The reason i'm using $rootScope instead of $scope for this variable and this function is that i'm planning to…
0
votes
0 answers

angular rootscope infdig error with auth interceptor

I have an angular fullstack app generated from angular-fullstack yeoman generator and I have the following error in my browser console - Uncaught SyntaxError: Unexpected token e angular.js:1072 SyntaxError: Unexpected token e at Object.parse…
0
votes
1 answer

rootscope getting reset when i change url directly from browser

I am using ui-router and states. When user logs in in rootscope i add a variable called profile and push in the logged in details. When i change state from UI i.e. clicking on a link rootscope.profile stays on, but if i change url directly…
Hacker
  • 7,798
  • 19
  • 84
  • 154
0
votes
3 answers

Querying a JSON-Structure in Angular: Find the right index and get a certain property of it

Assume, following JSON Structure is existing: [ { "role_id": 1, "role_name": "Admin" }, { "role_id": 2, "role_name": "Editor" } ] and stored in $rootScope.roles. What I need is: $rootScope.roles[index -> where role_id ==…
user2227400
0
votes
0 answers

Can't access scope data in Angularjs

I am currently working on angular app and bumped into a problem. The problem is when I'm getting the data form backend through factory into controller, eventhrough I apply this data to scope I can't access it later in this controller. My fist try:…
Miha2255
  • 61
  • 5
0
votes
1 answer

dynamic multidimensional arrays looping

I need to create a multidimensional array using intervals. I have 5 users who's data grows every 5 seconds. Each user needs array to hold this data that can be accessed for each user later. currently $rootScope.BHR looks like…
0
votes
0 answers

Communicate to a sibling controller who is not explicitly defined

Hello I have the following situation I have a controller with a Method, that sets a timeout and calls a modal along with other actions: angular .module('app') .controller('GlobalController', GlobalController); function…
DJ22T
  • 1,628
  • 3
  • 34
  • 66
0
votes
1 answer

How to cancel $interval Method without ng-click?

Actually I Need to Fire $http call to get the data for every 5 Seconds From One Controller. I need to Cancel the Interval in the Other Controller . Code Follows :- Controller 1(Find all Events):- function($interval,$timeout) { …
Prasad
  • 1,562
  • 5
  • 26
  • 40
0
votes
0 answers

$modal.open() actions in result not updating in form validation directive

I have an angular directive called "show-errors" that I use for form validation. This will apply the "has-error" css class to the containing div when validation fails. This works great in most cases, such as when a user leaves the input box (blur)…
0
votes
1 answer

can't get rootscope working in controller

so im trying to broadcast a event from a controller to another. but i keep getting this error my controller look like this. angular.module('myApp',[]). controller('20SettingsController', ['$rootscope','$scope', '$http', '$modal', …
DaCh
  • 921
  • 1
  • 14
  • 48
0
votes
1 answer

$scope value not able to read in controller

I am not sure what is wrong with this but somehow not able to read correct value of $scope. Here is my code at controller --> $scope.verifyMobile = SearchFactory.verify.query({uuid: uuid}); The JSON returned by rest service is --> verifyNumber --…
0
votes
0 answers

Message pub/sub in angularjs

I am creating a messaging service in angularjs project I am working. (function (angular) { 'use strict'; angular.module('MyApp').factory('messagebus', messagebus); messagebus.$inject = ['$rootScope']; function…
rednerus
  • 401
  • 2
  • 9
  • 21