title: How to call custom Javascript functions from an AngularJS controller?
body: <p>I have a standard function in <code>app.js</code> defined as follows:</p>
  
  <pre><code>var app = angular.module('app', ['ngResource', 'ngRoute', 'ngSanitize'], function () {
  
  });
  
  
  $(document).ready(function () {
      // standard error box
      function showError(title, content) {
          $.bigBox({
              title: title,
              content: content == null ? "An error occurred.&lt;br /&gt;&lt;br /&gt;If this error persists, please contact support." : content,
              color: "#C46A69",
              //timeout: 6000,
              icon: "fa fa-warning shake animated",
              //number: "1",
              timeout: 3000
          });
      }
  });
  </code></pre>
  
  <p>In an AngularJS controller method, I want to be able to call showError():</p>
  
  <pre><code>                    someFunction()
                          .success(function (result) {
                              // great!
                          })
                          .error(function (error) {
                              // call standard error message function
                              showError("Update Failed"); // use default error message
                          });
  </code></pre>
  
  <p>I know app.js is loaded, but I am not sure on how to call some of my own custom functions within the context of AngularJS.</p>
  
  <p>There is a vestigial function in the <code>angular.module</code> definition, as I tried putting my custom function in there to see if this would work - no.</p>
  
  <p>What is the appropriate way of accomplishing this?</p>
  
  <p><strong>-- UPDATE --</strong></p>
  
  <p>To clarify, I will want to invoke many custom functions like <code>showError()</code> and <code>showSuccess()</code> from many controllers, so these functions should have global scope, and not confined to one specific Angular controller.</p>