1

In this code, the controller is being supplied an injected scope and rootScope, so why does it fail on the last line with:

ReferenceError: $rootscope is not defined

angular.module("myEntity").controller('productsCtrl', [
    '$scope', 'MyAction', '$rootScope', function ($scope, MyAction, $rootScope) {
        $scope.propertyValue = something;
        $scope.canDoSomething = $rootscope.myRootScopeProperty = 1;
        .... 
1
  • 4
    it's $rootScope (capital S), you have a typo. Commented Apr 4, 2017 at 6:40

3 Answers 3

4

Just convert this

$rootscope

to this

$rootScope
Sign up to request clarification or add additional context in comments.

Comments

1

change $rootscope to $rootScope

Comments

0

here error is $rootscope, so we need to change it to $rootScope.,

problem:

$scope.canDoSomething = $rootscope.myRootScopeProperty = 1;

ReferenceError: $rootscope is not defined

solution:

$scope.canDoSomething = $rootScope.myRootScopeProperty = 1;

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.