angular.module('createPageController.controller', [])
  .controller('createPageController', function($scope, $http, $routeParams, $location, pageService) {
    $scope.message = "first";
    $scope.name = $routeParams.name;

    $scope.createPage = function(pass) {
      pageService.createPage($routeParams.name, pass).success(function(res) {
        $location.path('/' + $routeParams.name);
      });
    };
  });

angular.module('createPageController.controller', [])
  .controller('createPageController', function($scope, $http, $routeParams, $location, pageService) {
    $scope.message = "first";
    $scope.name = $routeParams.name;

    pageService.getPage($routeParams.name).success(function() {
      $location.path('/' + $routeParams.name);
    });

    $scope.createPage = function(pass) {
      pageService.createPage($routeParams.name, pass).success(function(res) {
        $location.path('/' + $routeParams.name);
      });
    };
  });

Create page will redirect to full page if already created
Create page will redirect to full page if already created
