mrkrstphr
5/7/2015 - 2:48 PM

Let's be cool with computers

Let's be cool with computers

In the route definition:

$routeProvider.when('/school/:schoolId/sent-invites', {
  templateUrl: 'sent_invites/sent_invites.html',
  controller: 'SentInvitesController',
  controllerAs: 'controller',
  activeTab: 'sent-invites',
  resolve: {
    school: ['$route', 'School', '$o', getSchool]
  }
});

In the new TabsController:

TabsController.$inject = ['$route', 'Me'];

function TabsController($route, Me) {
  this.activeTab = 'activeTab' in $route.current ? 
    $route.current.activeTab : '';
  this.schoolId = 'schoolId' in $route.current.params ? 
    $route.current.params.schoolId : null;
  this.user = Me.user;
}