Skip to content

Instantly share code, notes, and snippets.

@misaxi
Created November 2, 2015 06:18
Show Gist options
  • Save misaxi/8112923dc5610237f9e0 to your computer and use it in GitHub Desktop.
Save misaxi/8112923dc5610237f9e0 to your computer and use it in GitHub Desktop.
Ionic: using $ionicHistory to calm down the ion-nav-bar
angular
.module('app')
.config(config)
.controller('EventsCtrl', EventsCtrl)
function config ($stateProvider) {
$stateProvider
.state('tab.events', {
url: '/events',
cache: false,
templateUrl: 'templates/events.html',
controller: 'EventsCtrl',
resolve: EventsCtrl.resolve
})
}
function EventsCtrl ($scope, events) {
angular.extend($scope, {
events: events
})
}
EventsCtrl.resolve = {
jobs: ($ionicHistory, EventService) => {
$ionicHistory.nextViewOptions({
historyRoot: true
})
return EventService.allEvents()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment