/**
 * @ngdoc function
 * @name domainManagerApp.controller:AboutCtrl
 * @description
 * # AboutCtrl
 * Controller of the domainManagerApp
 */
angular.module('goApp.page', ['ngFx', 'ngAnimate', 'goApp.data'])
  .controller('PageController',['$scope', '$rootScope', '$famous', '$timeline', '$location', '$route', '$timeout', 'Data', '$mixpanel', function ($scope,  $rootScope, $famous, $timeline, $location, $route, $timeout, Data, $mixpanel) {

    'use strict';

    console.log('> Loading Text Page');


    // Get Page Data
    var link = $location.url();
    $scope.pageData = Data.getPageData(link);
    $rootScope.$on('data:loaded', function(data) {
      if(!$scope.$$phase) {
        $scope.$apply(function(){
          $scope.pageData = Data.getPageData(link);
          $scope.showSlider();
          $mixpanel.track('Page View', { "Page": $scope.pageData.link });
        });
      }
    });

    // FadeIn
    $timeout(function(){
      $scope.showView = true;
    },100);
    // FadeOut
    $scope.fadeOut = function() {
      $scope.showView = false;
      $timeout(function(){
        $scope.showView = false;
        $location.path("/");
      },800);
    };






  }]);