Angular scope does not work
<p>I'm writing a simple web application, and I'm using a directive for google sign in. </p>

<p>When I set scope values in $on method, it does not work in my html page.</p>

<p>This is my javascript: </p>

<pre><code>"use strict";
var loginApp = angular.module("myApp", ["ngMaterial", "ngMessages","ngRoute", "directive.g+signin"]);


loginApp.controller("AppCtrl", function ($scope, $http, $mdDialog, $window) {

  $scope.pages       = ["login.html", "guess.html", "employee.html","admin.html"];
  $scope.currentPage = $scope.pages[0];

  $scope.openPage    = function (num) {
    console.log(num);
    $scope.currentPage = $scope.pages[num];
    console.log("asd");
  };

  $scope.profile = [];
  $scope.name;

  $scope.$on('event:google-plus-signin-success', function (event, authResult) {
          // User successfully authorized the G+ App
    console.log('Signed in!asd');
    var profile = authResult.getBasicProfile();
    // console.log('ID: ' + profile.getId()); // Do not send to your backend! Use an ID token instead.
    // console.log('Name: ' + profile.getName());
    // console.log('Image URL: ' + profile.getImageUrl());
    // console.log('Email: ' + profile.getEmail());
    $scope.name = profile.getName();
    console.log($scope.name);
    $scope.openPage(1);

  });

  $scope.$on('event:google-plus-signin-failure', function (event, authResult) {
    // User has not authorized the G+ App!
    console.log('Not signed into Google Plus.');
  });

});
</code></pre>