title: How send error firebase message from service to controller?
body: <p>I use Angular js and firebase.
  For my login form and my register form, i have a controller "userController" who call function in userProvider, my service.</p>
  
  <p>I want to show the firebase error message in my view. How my provider can send message to my controller ?</p>
  
  <p>My code :</p>
  
  <p>userController.js :</p>
  
  <pre class="lang-js prettyprint-override"><code>$scope.login = function(user){
              userProvider.login(user);
   }
  </code></pre>
  
  <p>userProvider.js :</p>
  
  <pre class="lang-js prettyprint-override"><code>this.login = function(user){
      Auth.$authWithPassword({//on connecte l'utilisateur
        email: user.email,
        password: user.password
      }).then(function(authData) {
          console.log("Utilisateur connecté:", authData.uid);
          $location.path('#/profil');
      }).catch(function(error) {
          console.error("Echec connexion:", error);
          // I want return the error.code for use it in my controller
      });
   }
  </code></pre>
  
  <p>login.html :
  </p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;form ng-hide="authData" class="form-signin col-md-6" name="loginForm" novalidate &gt;
  &lt;h2 class="form-signin-heading"&gt;Connexion&lt;/h2&gt;
  &lt;p style="color:red;" ng-show="userDataError"&gt;{{userDataErrorMessage}}&lt;/p&gt;
  
  &lt;div class="form-group" ng-class="{ 'has-error' : loginForm.email.$invalid }"&gt;
      &lt;label for="inputEmail"&gt;Email&lt;/label&gt;
      &lt;input type="email"  class="form-control" placeholder="Email address" ng-model="user.email" name="email" ng-required autofocus&gt;
      &lt;p class="help-block text-error" ng-show="loginForm.email.$invalid"&gt;Cet email n'est pas valide&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class="form-group" ng-class="{ 'has-error' : loginForm.password.$invalid }"&gt;
      &lt;label for="inputPassword"&gt;Password&lt;/label&gt;
      &lt;input type="password" class="form-control" placeholder="Password"  ng-model="user.password" ng-minlength="8" name="password" ng-required&gt;
      &lt;p class="help-block text-warning" ng-show="loginForm.password.$error.minlength" &gt;Minimum 8 caractères&lt;/p&gt;
  &lt;/div&gt;
  &lt;button  class="btn btn-lg btn-primary btn-block" ng-disabled="loginForm.$invalid" ng-click="login(user)"&gt;Connexion&lt;/button&gt;
  </code></pre>
  
  <p></p>