How to use the @material/chips.MDCChipSetFoundation function in @material/chips

To help you get started, we’ve selected a few @material/chips examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github angular / components / src / material-experimental / mdc-chips / chip-listbox.ts View on Github external
constructor(protected _elementRef: ElementRef,
              _changeDetectorRef: ChangeDetectorRef,
              @Optional() _dir: Directionality) {
    super(_elementRef, _changeDetectorRef, _dir);
    this._chipSetAdapter.selectChipAtIndex = (index: number, selected: boolean) => {
      this._setSelected(index, selected);
    };
    // Reinitialize the foundation with our overridden adapter
    this._chipSetFoundation = new MDCChipSetFoundation(this._chipSetAdapter);
    this._updateMdcSelectionClasses();
  }
github angular / components / src / material-experimental / mdc-chips / chip-set.ts View on Github external
constructor(protected _elementRef: ElementRef,
              protected _changeDetectorRef: ChangeDetectorRef,
              @Optional() protected _dir: Directionality) {
    super(_elementRef);
    this._chipSetFoundation = new MDCChipSetFoundation(this._chipSetAdapter);
  }
github trimox / angular-mdc-web / packages / chips / chip-set.ts View on Github external
getDefaultFoundation() {
    const adapter: MDCChipSetAdapter = {
      hasClass: (className: string) => this._getHostElement().classList.contains(className),
      removeChip: (chipId: string) => {
        const index = this._findChipIndex(chipId);
        this.chips.toArray().splice(index, 1);
      },
      setSelected: (chipId: string, selected: boolean) => {
        const chip = this.getChipById(chipId);
        if (chip) {
          chip.selected = selected;
        }
      }
    };
    return new MDCChipSetFoundation(adapter);
  }