12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. import { Attribute, Directive, NgZone } from '@angular/core';
  2. import { Platform } from '../../platform/platform';
  3. import { DisplayWhen } from './display-when';
  4. /**
  5. * @name HideWhen
  6. * @description
  7. * The `hideWhen` attribute takes a string that represents a plaform or screen orientation.
  8. * The element the attribute is added to will only be hidden when that platform or screen orientation is active.
  9. *
  10. * Complements the [showWhen attribute](../ShowWhen). If the `hideWhen` attribute is used on an
  11. * element that also has the `showWhen` attribute, the element will not show if `hideWhen` evaluates
  12. * to `true` or `showWhen` evaluates to `false`. If the `hidden` attribute is also added, the element
  13. * will not show if `hidden` evaluates to `true`.
  14. *
  15. * View the [Platform API docs](../../../platform/Platform) for more information on the different
  16. * platforms you can use.
  17. *
  18. * @usage
  19. * ```html
  20. * <div hideWhen="android">
  21. * I am hidden on Android!
  22. * </div>
  23. *
  24. * <div hideWhen="ios">
  25. * I am hidden on iOS!
  26. * </div>
  27. *
  28. * <div hideWhen="android,ios">
  29. * I am hidden on Android and iOS!
  30. * </div>
  31. *
  32. * <div hideWhen="portrait">
  33. * I am hidden on Portrait!
  34. * </div>
  35. *
  36. * <div hideWhen="landscape">
  37. * I am hidden on Landscape!
  38. * </div>
  39. * ```
  40. *
  41. * @demo /docs/demos/src/hide-when/
  42. * @see {@link ../ShowWhen ShowWhen API Docs}
  43. * @see {@link ../../../platform/Platform Platform API Docs}
  44. */
  45. export class HideWhen extends DisplayWhen {
  46. constructor(hideWhen, plt, zone) {
  47. super(hideWhen, plt, zone);
  48. }
  49. }
  50. HideWhen.decorators = [
  51. { type: Directive, args: [{
  52. selector: '[hideWhen]',
  53. host: {
  54. '[class.hidden-hide-when]': 'isMatch'
  55. }
  56. },] },
  57. ];
  58. /** @nocollapse */
  59. HideWhen.ctorParameters = () => [
  60. { type: undefined, decorators: [{ type: Attribute, args: ['hideWhen',] },] },
  61. { type: Platform, },
  62. { type: NgZone, },
  63. ];
  64. //# sourceMappingURL=hide-when.js.map