Skip to content

Instantly share code, notes, and snippets.

@vitaliy-bobrov
Created February 5, 2015 14:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vitaliy-bobrov/b908d3796e2edabc06ab to your computer and use it in GitHub Desktop.
Save vitaliy-bobrov/b908d3796e2edabc06ab to your computer and use it in GitHub Desktop.
Blogin App Routes Step 1
.config(['$stateProvider', '$urlRouterProvider', function($stateProvider, $urlRouterProvider) {
// Bar with tabs.
$stateProvider.state('tab', {
url: '/tab',
abstract: true,
templateUrl: 'templates/tabs.html'
})
// Categories list tab.
.state('tab.categories', {
url: '/categories',
views: {
'tab-categories': {
templateUrl: 'templates/tab-categories.html',
controller: 'CategoriesCtrl'
}
}
})
// One category tab with it articles.
.state('tab.category', {
url: '/category/:catId',
views: {
'tab-categories': {
templateUrl: 'templates/category.html',
controller: 'CategoryCtrl'
}
}
})
// Article details page with full post content.
.state('tab.category-article', {
url: '/category/article/:articleId',
views: {
'tab-categories': {
templateUrl: 'templates/article-detail.html',
controller: 'ArticleDetailCtrl'
}
}
})
// All articles tab.
.state('tab.articles', {
url: '/articles',
views: {
'tab-articles': {
templateUrl: 'templates/tab-articles.html',
controller: 'ArticlesCtrl'
}
}
})
// Article details page with full post content.
.state('tab.article-detail', {
url: '/articles/:articleId',
views: {
'tab-articles': {
templateUrl: 'templates/article-detail.html',
controller: 'ArticleDetailCtrl'
}
}
});
// default state that shows all articles tab.
$urlRouterProvider.otherwise('/tab/articles');
}]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment