function Directive($state) {
return {
restrict: 'E',
replace: true,
templateUrl: 'partials/hero/template.html',
link: Link
};
function Link(scope) {
scope.hero = {
title: 'This is a test',
swatch: 'red-1'
};
if ($state.$current.name !== '') {
updateHero();
}
scope.$on('$stateChangeSuccess', updateHero);
function updateHero() {
var currentState = $state.$current;
scope.hero = {
title: currentState.data.title,
swatch: currentState.data.swatch
};
}
}
}