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

If user 'touches' form inputs on profile & forgets to save: show `POP UP` when they click SideMenu icon

I've tried to come up with some sort of "error checker/validation" for my users IF they forget to Save the edits they made on their profiles. The user enters the Profile.html state. They start to update some of their info (i.e name, phone number,…
0
votes
1 answer

How to set information into index.html outside the ng-view

I'm working with angular for the first time and having some trouble showing some dynamic information in my index.html file. Everything inside the ng-view tag is working great. When a user authenticates, a global variable with user information is put…
Wheels
  • 155
  • 1
  • 16
0
votes
1 answer

Cannot access $rootScope property from controller?

In angular's run block i am setting one property on $rootScope however when controller executes that property doesn't exists on $rootScope. When application starts, in debugger i see "adal:loginSuccess" handler gets executed and $rootScope.isAdmin…
LP13
  • 30,567
  • 53
  • 217
  • 400
0
votes
1 answer

AngularJS on $stateChangeStart loop

In a web application I want that, when the user route in the $state, Angular checks if there is a token and if he has permission. But I have a problem: even if I do event.preventDefault(), it starts a loop and browser crashes. How can i prevent this…
0
votes
1 answer

How to listen to $rootscope.$broadcast with $scope

My $scope.$on(... doesn't seem to be picking up the broadcast. I have an interceptor to capture http response errors and broadcast an event that my main controller can react to. (function () { 'use strict'; angular .module('app') …
PeteGO
  • 5,597
  • 3
  • 39
  • 70
0
votes
1 answer

AngularJS 1 with TypeScript: where in controller to put $rootScope.on?

Service export class RandomServiceName implements ng.IServiceProvider { /* @ngInject */ constructor(private $rootScope: ng.IRootScopeService) { } public $get(): RandomServiceName { return this; } doStuff() { …
A T
  • 13,008
  • 21
  • 97
  • 158
0
votes
1 answer

AngularJS caching batch entity GET to individual entity services?

So I have an endpoint which returns the contents of many entities in parallel. I have a shared service which calls this endpoint and puts them into a shared $cacheFactory. When GET /base_entity//all route is hit first, then GET /entity/
A T
  • 13,008
  • 21
  • 97
  • 158
0
votes
2 answers

Syntax to access rootScope variable in MyController

In the below code,
overexchange
  • 15,768
  • 30
  • 152
  • 347
0
votes
2 answers

Variable class not changed when modify $rootscope

I have two controllers: Parent Controller 'use strict'; app.controller('CoreController', function($scope,$window,$location,$rootScope,AuthFactory) { var requiredLogin = true; $rootScope.bodyClass = ''; $rootScope.pageTitle = ''; …
50l3r
  • 1,549
  • 4
  • 16
  • 27
0
votes
1 answer

Angular the scop view dont updates may view

I have small app the getting data from signalR and passes them back to controller from the factory. but when the rootScope triggers and pass the object to the scope this data dosent updated on the view. here is my controller code: (function ()…
Misha Beskin
  • 315
  • 4
  • 9
0
votes
1 answer

Change child scope using broadcast from app.run

I have an angular app with the name DemoProject. I have an app.run controller and one child controller JS var app = angular.module("DemoProject", ['ngRoute', 'ngAnimate', 'ngMessages', 'ngMaterial']); app.run(function ($rootScope, $route,…
0
votes
2 answers

Why I can't set/get $rootScope?

I try to set a a value in $rootScope in a .run() and try to get it in a service but it looks like it's undefined. Everything else in the .run() and in the service is running fine. .run(function($ionicPlatform, $translate, $rootScope) { …
Edo
  • 1,539
  • 18
  • 26
0
votes
3 answers

How to pass an array from one view to another within same controller

I am just a newbie to angularjs. I have a form in one view of my application which shows on my other view. There is only one controller for the application. The user can enter the fields in the form which should get displayed on the other view. The…
0
votes
1 answer

delay in hiding loader icon after $stateChangeSuccess

I know there's a lot written about this, but I can't find a solution to this particular problem. When changing a state, I want the current state to be hidden and for the spinner to be displayed on $stateChangeStart, and for the spinner to be hidden…
0
votes
2 answers

Angular $rootscope.$broadcast correct usage in a service

From what I've read, it seems using $rootScope.$broadcast is not advisable unless absolutely necessary. I'm using it in a service to notify a controller that a variable has changed. Is this incorrect? Is there a better way to do it? Should I be…
shanahobo86
  • 467
  • 2
  • 7
  • 23