Skip to content

Instantly share code, notes, and snippets.

@Cengizism
Created December 7, 2013 16:06
Show Gist options
  • Save Cengizism/937aa4df6f5998306501 to your computer and use it in GitHub Desktop.
Save Cengizism/937aa4df6f5998306501 to your computer and use it in GitHub Desktop.
change route directive
'use strict';
var directives = angular.module('guthub.directives', []);
directives.directive('butterbar', ['$rootScope',
function($rootScope) {
return {
link: function(scope, element, attrs) {
element.addClass('hide');
$rootScope.$on('$routeChangeStart', function() {
element.removeClass('hide');
});
$rootScope.$on('$routeChangeSuccess', function() {
element.addClass('hide');
});
}
};
}]);
directives.directive('focus',
function() {
return {
link: function(scope, element, attrs) {
element[0].focus();
}
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment