Skip to content

Instantly share code, notes, and snippets.

@Hendrixer
Created December 3, 2015 20:56
Show Gist options
  • Save Hendrixer/10a71040e01b4ad74e3b to your computer and use it in GitHub Desktop.
Save Hendrixer/10a71040e01b4ad74e3b to your computer and use it in GitHub Desktop.
using resolve with components
angular.moudle('app', [])
.config($stateProvider => {
$stateProvider
.state('profile', {
url: '/profile',
template: '<profile-page profile="profile"></profile-page>',
controller(profile, $scope){ // use 'function' if minifying
$scope.profile = profile;
},
resolve: {
profile: function(){
return {};
}
}
})
})
.directive('profilePage', () => {
return {
scope: {
profile: '='
},
// .... rest of config
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment