title: Why using $rootScope with functions is not recommended?
body: <p>While am looking into the FEQs of Angularjs I've seen below article:</p>
  <blockquote>
  <p><strong>$rootScope exists, but it can be used for evil</strong></p>
  <p>Scopes in Angular form a hierarchy, prototypally inheriting from a root scope at the top of the tree. Usually this can be ignored, since most views have a controller, and therefore a scope, of their own.</p>
  <p>Occasionally there are pieces of data that you want to make global to the whole app. For these, you can inject <code>$rootScope</code> and set values on it like any other scope. Since the scopes inherit from the root scope, these values will be available to the expressions attached to directives like <code>ng-show</code> just like values on your local <code>$scope</code>.</p>
  <p>Of course, global state sucks and you should use <code>$rootScope</code> sparingly, like you would (hopefully) use with global variables in any language. In particular, don't use it for code, only data. If you're tempted to put a function on <code>$rootScope</code>, it's almost always better to put it in a service that can be injected where it's needed, and more easily tested.</p>
  <p>Conversely, don't create a service whose only purpose in life is to store and return bits of data.</p>
  <p><a href="https://docs.angularjs.org/misc/faq#-rootscope-exists-but-it-can-be-used-for-evil" rel="nofollow noreferrer">— AngularJS FAQ - $rootScope exists, but it can be used for evil</a></p>
  </blockquote>
  <p><strong>So My doubt is why $rootScope is not recommended for functions as a global function? Is there any performance issue?</strong></p>