ApiCtrl = function($anchorScroll, $http, $location, $route, $sce, $scope) {
    this.$http = $http;
    this.$route = $route;
    this.$scope = $scope;

    this.loadTableOfContents();

    $scope.items = [];
    $scope.isMenuVisible = false;
    $scope.currentItem = null;

    // Watch for location changes to show the correct item.
    $scope.$on('$locationChangeSuccess', function() {
      // Not going to api? ignore event.
      if (!$location.url().match(/^\/api/)) {
        return;
      }

      var view = $route.current.params.view,
          item = _.findWhere($scope.items, {name: view});

      if (view && item) {
        $scope.showElement(item);
      } else {
        // No view? Show default item.
        $scope.currentItem = defaultItem;
      }
    });

    $scope.toggleMenuLabel = function() {
      return $scope.isMenuVisible ? 'Hide list' : 'Show list';
    };

    $scope.toggleMenu = function() {
      $scope.isMenuVisible = !$scope.isMenuVisible;
    };

    $scope.showElement = function(item) {
      // Update the query string with the view name.
      $location.search('view', item.name);
      $scope.currentItem = item;

      // Scroll to the top.
      $anchorScroll();
    };

    $scope.trust = function(html) {
      return trustHTML($sce, html);
    };
  }
Controller for the protractor api view.

@constructor
@ngInject
@param $anchorScroll anchorScroll service.
@param $http HTTP service.
@param $location Location service.
@param $route Route service.
@param $sce Strict Contextual Escaping service.
@param $scope Angular scope.