Last active
August 29, 2015 14:05
-
-
Save krtek/9bc3cf21f7dfb118775b to your computer and use it in GitHub Desktop.
Modular application in Angular.JS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('core', []).provider('Menu', function() { | |
var _menu = []; | |
this.$get = function() { | |
return { | |
get: function() { | |
return _menu; | |
} | |
}; | |
}; | |
this.add = function(item) { | |
_menu.push(item); | |
}; | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('gustav', ['core', 'history']) | |
.config(function($routeProvider, $locationProvider) { | |
$routeProvider.when('/home', { | |
templateUrl: 'partials/home.html', | |
controller: 'HomeCtrl' | |
}); | |
$routeProvider.otherwise({redirectTo: '/home'}); | |
}) | |
.config(function(MenuProvider) { | |
MenuProvider.add({ | |
icon: "glyphicon glyphicon-home", | |
url: '/home', | |
title: 'Domů', | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('history', ['core']).config(function($routeProvider, $locationProvider) { | |
$routeProvider.when('/history', { | |
templateUrl: 'partials/history.html', | |
controller: 'HistoryCtrl' | |
}); | |
}) | |
.config(function(MenuProvider) { | |
MenuProvider.add({ | |
icon: "glyphicon glyphicon-th-list", | |
url: '/history', | |
title: 'Transakce', | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment