This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<app-error-card></app-error-card> | |
<app-error-card> | |
Another error text | |
<div> | |
<a href="google.com">Google it</a> | |
</div> | |
</app-error-card> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{{text}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
Component, | |
ChangeDetectionStrategy, | |
Input, | |
Output, | |
EventEmitter, | |
HostListener, | |
ViewChild, | |
ElementRef, | |
forwardRef, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class MultiselectComponent implements ControlValueAccessor { | |
[...] | |
open = false; | |
disabled = false; | |
[...] | |
writeValue(items: Array<ListItem>): void { | |
this.selectedItems = items || []; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class MultiselectComponent implements ControlValueAccessor { | |
[...] | |
private onChange = (_: Array<ListItem>) => { }; | |
private onTouch = () => { }; | |
@HostListener('document:click', ['$event.target']) | |
public onClick(targetElement) { | |
const clickedInside = this.multiselect.nativeElement.contains(targetElement); | |
if (!clickedInside) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class MultiselectComponent implements ControlValueAccessor { | |
[...] | |
private onChange = (_: Array<ListItem>) => { }; | |
private onTouch = () => { }; | |
@HostListener('document:click', ['$event.target']) | |
public onClick(targetElement) { | |
const clickedInside = this.multiselect.nativeElement.contains(targetElement); | |
if (!clickedInside) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class MultiselectComponent implements ControlValueAccessor { | |
[...] | |
private onChange = (_: Array<ListItem>) => { }; | |
[...] | |
writeValue(items: Array<ListItem>): void { | |
throw new Error('Method not implemented.'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<app-multiselect name="my-component" [items]="possiblePets" (itemSelected)="addPet($event)"></app-multiselect> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$color-border: #adadad; | |
$color-selected: #d2d2d2; | |
$color-selected-background: #fcfcfc; | |
$spacing-extra-small: 4px; | |
$spacing-small: 8px; | |
$spacing-large: 12px; | |
$border-radius: 3px; | |
:host { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div #multiselect class="multiselect"> | |
<div class="input" (click)="toggleDropdown()"> | |
<span (click)="onItemClick(item)" class="selected-item" *ngFor="let item of selectedItems;trackBy: trackByFn"> | |
{{item.text}} | |
</span> | |
</div> | |
<div class="dropdown-list" [hidden]="!open"> | |
<ul> | |
<li *ngFor="let item of items" (click)="onItemClick(item)" | |
[class.selected]="isItemAlreadySelected(item)"> |