title: How to register a function on $rootScope on angularjs ready
body: <p>I need to register a method available everywhere in angularjs. This method  has 2 arguments (the resource id, the callback on deletion success) and it uses the resource provider to actually delete the item.</p>
  
  <p>Then to register it, I need that angularjs injects me the <code>$rootScope</code> and <code>MyResourceProvider</code>. My first idea was to do that in my home page controller: </p>
  
  <pre>
      var HomeCtrl = function ($rootScope, MyResourceProvider) {
          $rootScope.confirmAndDeletePackage = function (sId, fCallback) {
              // do some stuff
              MyResourceProvider.delete({id: sId}, fCallback);
          }
      }
  </pre>
  
  <p>Here starts actually my issue. That works fine in a regular navigation (home -> list -> select -> delete) but if the user accesses directly a page where the delete button is available w/o passing through the home page, this method will not be available (because the HomeController has not been initialized)...</p>
  
  <p>So, my question is where can I move this piece of code to ensure it will always be executed at the application bootstrap.</p>
  
  <p>I tried on <code>myApp.config()</code> but w/o success...</p>
  
  <p>Any idea?</p>