Options
All
  • Public
  • Public/Protected
  • All
Menu

Class FilterComponent

whatitdoes

Returns a filter bar that filters recipes

consumers

HomeComponent

Hierarchy

  • FilterComponent

Implements

  • AfterViewInit
  • OnDestroy
  • OnInit

Index

Constructors

constructor

Properties

change

change: EventEmitter<Object> = new EventEmitter()

Emits the time during an update to trigger pipes relying on an update event.

dontCloseOnScroll

dontCloseOnScroll: boolean = false

Option to prevent onScroll default behaviour.

drawerEvent

drawerEvent: EventEmitter<Object> = new EventEmitter()

Ouputs events related to the drawer opening/closing.

drawerOpen

drawerOpen: boolean = false

Current state of the drawer.

  • The drawer is div that shows/hides extra filter options
  • Set to closed by default

Private el

el: ElementRef

a reference to the FilterComponent element

filterItems

filterItems: FilterItems

Optional filter items.

  • Filter by search
  • Filter by select boxes (array)

Private filterUtilitiesService

filterUtilitiesService: FilterUtilitiesService

used for simple utility functions.

filterValues

filterValues: object

Contains filter information usually sent to a pipe for filtering data.

Type declaration

Private globalEventsService

globalEventsService: GlobalEventsService

used to subscribe to global events like scroll

map

map: string

Used to reorder the input fields via the RemapPipe

resizeSubscription

resizeSubscription: Subscription

Holds the subscription for the globalEventsService's resize subscription.

scrollSubscription

scrollSubscription: Subscription

Used to hold the .unsubscribe() method to the scroll subscription when active.

  • Unsubscribe is called if the user scrolls while the drawer is open.

Private showingResults

showingResults: boolean = false

True if the filter bar is at the top of the page for sure.

update

update: EventEmitter<Object> = new EventEmitter()

Emits the filterValues object.

Private window

window: Window

Methods

Private checkWidth

  • checkWidth(): void

Private closeDrawer

  • closeDrawer(): void
  • Closes the additional filter options.

    • Unsbuscribes from the scroll subscription
    • Resets varibles
    • Emits a drawer event

    Returns void

ngAfterViewInit

  • ngAfterViewInit(): void

ngOnDestroy

  • ngOnDestroy(): void

ngOnInit

  • ngOnInit(): void
    • Subscribes to the global scroll event.
    • Subscribes to the global resize event and assumes results may not be showing on resize.
    • Triggers an update with init data

    Returns void

onDrawerToggle

  • onDrawerToggle(): void
  • Called when the drawer is toggled. It:

    • toggles the drawer state
    • emits a drawer event
    • unscrolls the page when the drawer opens

    Returns void

onScroll

  • onScroll(): void

onSelectUpdate

  • onSelectUpdate(name: string, value: any): void
  • Triggered on an update from a select input.

    • Turns the human name into a camelcase key
    • Attaches the new value to the key
    • Send the data via onUpdate

    Parameters

    • name: string
    • value: any

    Returns void

onUpdate

  • onUpdate(): void
  • Triggered on an update from all inputs

    • Emits the current filter values
    • Emits the current time to trigger pure pipes

    Returns void

Generated using TypeDoc