By a defined object is giving the indefinite error in Angularjs

Asked

Viewed 30 times

1

I am getting an error by performing the following test:

it('testing if the onStateChangeErrorHandle function is defined', function(){
  expect(rootScope.$on).toBeDefined();              
  srv.onStateChangeError({$rootScope: rootScope});
});

ERROR:

Typeerror: Undefined is not an Object (evaluating 'rootScope. $on')

And I don’t understand why.

  • defined rootScope before? if you don’t use $rootScope

  • @Felipeduarte is set yes. rootScope = $rootScope;

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.