Pass value of scope to another scope in AngularJS
<p>I have a controller and want to pass a value of a scope to another.</p>

<pre><code>app.controller("ChatController", function($scope, $firebaseArray, $timeout, $firebaseAuth, $window) {
  var ref = firebase.database().ref().child("messages");
  var auth = $firebaseAuth();

  $scope.messages = $firebaseArray(ref);

  $scope.sendMessage = function() {

   //var firebaseUser = $scope.firebaseUser;

    $scope.messages.$add({
      text: $scope.newMessageText,
      current_time: new Date().toJSON()
    });
    $scope.newMessageText = null;
  };

  $scope.login = function() {
      $scope.firebaseUser = null;
      $scope.error = null;

      auth.$signInWithPopup('google').then(function(firebaseUser) {
        $scope.firebaseUser = firebaseUser; //access this to the sendMessage scope
        console.log(firebaseUser.user);
      }).catch(function(error) {
        $scope.error = error;
      });

  };

});
</code></pre>

<p>Above me, I have <code>sendMessage</code> and <code>login</code> <code>scope</code>. I want to pass the value of <code>$scope.firebaseUser</code> to the <code>login</code> <code>scope</code>. Is that possible?</p>