Sha256: 443fb25ea4eb44aa30a7390b8c63e870ab294f899365a62fa1eccad8a01b2242

Contents?: true

Size: 1.77 KB

Versions: 8

Compression:

Stored size: 1.77 KB

Contents

/**
 * uiShow Directive
 *
 * Adds a 'ui-show' class to the element instead of display:block
 * Created to allow tighter control  of CSS without bulkier directives
 *
 * @param expression {boolean} evaluated expression to determine if the class should be added
 */
angular.module('ui.directives').directive('uiShow', [function () {
  return function (scope, elm, attrs) {
    scope.$watch(attrs.uiShow, function (newVal, oldVal) {
      if (newVal) {
        elm.addClass('ui-show');
      } else {
        elm.removeClass('ui-show');
      }
    });
  };
}])

/**
 * uiHide Directive
 *
 * Adds a 'ui-hide' class to the element instead of display:block
 * Created to allow tighter control  of CSS without bulkier directives
 *
 * @param expression {boolean} evaluated expression to determine if the class should be added
 */
  .directive('uiHide', [function () {
  return function (scope, elm, attrs) {
    scope.$watch(attrs.uiHide, function (newVal, oldVal) {
      if (newVal) {
        elm.addClass('ui-hide');
      } else {
        elm.removeClass('ui-hide');
      }
    });
  };
}])

/**
 * uiToggle Directive
 *
 * Adds a class 'ui-show' if true, and a 'ui-hide' if false to the element instead of display:block/display:none
 * Created to allow tighter control  of CSS without bulkier directives. This also allows you to override the
 * default visibility of the element using either class.
 *
 * @param expression {boolean} evaluated expression to determine if the class should be added
 */
  .directive('uiToggle', [function () {
  return function (scope, elm, attrs) {
    scope.$watch(attrs.uiToggle, function (newVal, oldVal) {
      if (newVal) {
        elm.removeClass('ui-hide').addClass('ui-show');
      } else {
        elm.removeClass('ui-show').addClass('ui-hide');
      }
    });
  };
}]);

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
active_record_survey_api-0.0.19 spec/test_app/vendor/assets/bower_components/angular-ui/modules/directives/showhide/showhide.js
active_record_survey_api-0.0.18 spec/test_app/vendor/assets/bower_components/angular-ui/modules/directives/showhide/showhide.js
active_record_survey_api-0.0.17 spec/test_app/vendor/assets/bower_components/angular-ui/modules/directives/showhide/showhide.js
active_record_survey_api-0.0.14 spec/test_app/vendor/assets/bower_components/angular-ui/modules/directives/showhide/showhide.js
active_record_survey_api-0.0.12 spec/test_app/vendor/assets/bower_components/angular-ui/modules/directives/showhide/showhide.js
active_record_survey_api-0.0.11 spec/test_app/vendor/assets/bower_components/angular-ui/modules/directives/showhide/showhide.js
active_record_survey_api-0.0.7 spec/test_app/vendor/assets/bower_components/angular-ui/modules/directives/showhide/showhide.js
active_record_survey_api-0.0.6 spec/test_app/vendor/assets/bower_components/angular-ui/modules/directives/showhide/showhide.js