ui-butterbar.js 717 B

12345678910111213141516171819
  1. angular.module('app')
  2. .directive('uiButterbar', ['$rootScope', '$anchorScroll', function($rootScope, $anchorScroll) {
  3. return {
  4. restrict: 'AC',
  5. template:'<span class="bar"></span>',
  6. link: function(scope, el, attrs) {
  7. el.addClass('butterbar hide');
  8. scope.$on('$stateChangeStart', function(event) {
  9. $anchorScroll();
  10. el.removeClass('hide').addClass('active');
  11. });
  12. scope.$on('$stateChangeSuccess', function( event, toState, toParams, fromState ) {
  13. event.targetScope.$watch('$viewContentLoaded', function(){
  14. el.addClass('hide').removeClass('active');
  15. })
  16. });
  17. }
  18. };
  19. }]);