/* Basic Config */
var pageOwner = 'Adalberto Kutuxidis';
var currentYear = 2016;

/* Module Configuration */
angular.
    module('adalber.to').

        /* Route Configuration */
        config(['$locationProvider', '$routeProvider', 'ROUTECONFIG',
            function ($locationProvider, $routeProvider, ROUTECONFIG) {

                console.log(ROUTECONFIG);

            $routeProvider.
                when('/home', {
                    pageTitle: 'Home',
                    templateUrl: 'app/gallery-list/gallery-list.template.html',
                    controller: GalleryListCtrl
                }).
                when('/projects', {
                    pageTitle: 'Projects',
                    templateUrl: 'app/gallery-list/gallery-list.template.html',
                    controller: GalleryListCtrl
                }).
                when('/about', {
                    pageTitle: 'About',
                    template: '<span>About</span>'
                }).
                when('/post/:postId', {
                    templateUrl: 'app/gallery-post/gallery-post.template.html',
                    controller: GalleryPostCtrl
                }).
                otherwise({
                    redirectTo: '/home'
                });
            }
        ]).

        /* Run Configuration */
        run(['$rootScope', function ($rootScope) {

            $rootScope.pageOwner = pageOwner;
            $rootScope.currentYear = currentYear;

            $rootScope.$on('$routeChangeSuccess',
                function (event, current, previous) {

                    if(current.$$route != undefined) {

                        $rootScope.pageTitle =
                            pageOwner + '/' + current.$$route.pageTitle;
                    }
                }
            );
        }]).

        /* Filter Configuration */
        filter('renderHTMLCorrectly', function($sce) {

            return function (stringToParse) {

                return $sce.trustAsHtml(stringToParse);
            }
        }).

        /* Theme Configuration */
        config(function ($mdThemingProvider) {

            $mdThemingProvider.definePalette('black', {
                '50': '#858585',
                '100': '#5e5e5e',
                '200': '#424242',
                '300': '#1f1f1f',
                '400': '#0f0f0f',
                '500': '#000000',
                '600': '#000000',
                '700': '#000000',
                '800': '#000000',
                '900': '#000000',
                'A100': '#858585',
                'A200': '#5e5e5e',
                'A400': '#0f0f0f',
                'A700': '#000000',
                'contrastDefaultColor': 'light',
                'contrastDarkColors': '50 A100'
            });

            $mdThemingProvider.definePalette('white', {
                '50': '#ffffff',
                '100': '#ffffff',
                '200': '#ffffff',
                '300': '#ffffff',
                '400': '#ffffff',
                '500': '#ffffff',
                '600': '#f0f0f0',
                '700': '#e0e0e0',
                '800': '#d1d1d1',
                '900': '#c2c2c2',
                'A100': '#ffffff',
                'A200': '#ffffff',
                'A400': '#ffffff',
                'A700': '#e0e0e0',
                'contrastDefaultColor': 'light',
                'contrastDarkColors':
                    '50 100 200 300 400 500 600 700 800 900 A100 A200 A400 A700'
            });

            $mdThemingProvider.theme('default')
                .primaryPalette('black')
                .accentPalette('blue')
                .warnPalette('red')
                .backgroundPalette('white');
        });

(function() {

    var initInjector = angular.injector(['ng']);
    var $http = initInjector.get('$http');

    $http.get('app/content/content.topbar.navigation.js').then(

        function(response) {

            angular.module('preLoader', [])
                .constant('ROUTECONFIG', response);

            angular.element(document).ready(function() {

                angular.bootstrap(document, ['adalber.to']);
            });
        }
    );
})();
@@ -336,20 +336,19 @@
     
-console.log(
+var data = 
 ROUT
@@ -354,17 +354,21 @@
 TECONFIG
-)
+.data
 ;%0A%0A     
@@ -378,222 +378,195 @@
     
-$routeProvider.%0A                when('/home', %7B%0A                    pageTitle: 'Home',%0A                    templateUrl: 'app/gallery-list/gallery-list.template.html',%0A                    controller: GalleryListCtrl
+    $locationProvider.hashPrefix('!');%0A%0A                for (var i = 0; i %3C data.length; i++) %7B%0A%0A                    if (data%5Bi%5D.type == %22list%22) %7B%0A%0A                        $routeProvider.
 %0A   
@@ -570,32 +570,24 @@
             
-    %7D).%0A
             
@@ -601,17 +601,38 @@
 n('/
-projects'
+' + data%5Bi%5D.name.toLowerCase()
 , %7B%0A
@@ -655,31 +655,58 @@
     
+ 
-pageTitle: 'Projects',%0A
+           pageTitle: data%5Bi%5D.title,%0A            
     
@@ -793,32 +793,44 @@
                 
+ 
+           
 controller: Gall
@@ -837,24 +837,36 @@
 eryListCtrl%0A
+            
             
@@ -863,33 +863,33 @@
               %7D)
-.
+;
 %0A               
@@ -893,24 +893,14 @@
     
-when('/about', %7B
+    %7D%0A
 %0A   
@@ -920,78 +920,78 @@
     
-pageTitle: 'About',%0A                    template: '%3Cspan%3EAbout%3C/span%3E'
+if (data%5Bi%5D.type == %22post%22) %7B%0A%0A                        $routeProvider.
 %0A   
@@ -995,32 +995,24 @@
             
-    %7D).%0A
             
@@ -1022,20 +1022,50 @@
  when('/
-post
+' + data%5Bi%5D.name.toLowerCase() + '
 /:postId
@@ -1065,24 +1065,36 @@
 :postId', %7B%0A
+            
             
@@ -1173,32 +1173,44 @@
                 
+     
+       
 controller: Gall
@@ -1237,20 +1237,142 @@
         
-%7D).%0A
+            %7D);%0A                    %7D%0A%0A                    if (i == 0) %7B%0A%0A                        $routeProvider.%0A            
         
@@ -1411,16 +1411,28 @@
         
+      
+      
 redirect
@@ -1441,33 +1441,110 @@
 : '/
-home'%0A                %7D);
+' + data%5Bi%5D.name.toLowerCase()%0A                            %7D);%0A                    %7D%0A                %7D
 %0A   

Change Route Implementation