Created
July 20, 2015 18:29
-
-
Save seemaullal/bb9d5080015247863e62 to your computer and use it in GitHub Desktop.
Angular Sample #2
This file contains 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
// This is a state and the controller that corresponds to the state | |
'use strict'; | |
angular.module('learndotApp') | |
.config(function ($stateProvider) { | |
$stateProvider | |
.state('calendar', { | |
url: '/calendar', | |
controller: 'CalendarCtrl', | |
templateUrl: 'app/calendar/calendar.html', | |
resolve: { | |
user: function(Auth) { | |
return Auth.getCurrentUserAsync(); | |
}, | |
cohort: function(UserCohortHelper, user) { | |
var helper = UserCohortHelper(user); | |
return helper.getCohortObjects() | |
.then(function(cohort) { | |
return cohort; | |
}); | |
} | |
}, | |
authenticate: true | |
}); | |
}); | |
//Controller | |
'use strict'; | |
angular.module('learndotApp') | |
.controller('CalendarCtrl', function ($scope, $sce,cohort) { | |
$scope.calendarLink = $sce.trustAsResourceUrl(cohort.calendarLink); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment