Skip to content

Instantly share code, notes, and snippets.

View angelo510's full-sized avatar
🏠
Working from home

Angelo ^_^ angelo510

🏠
Working from home
  • Independent Freelancer
View GitHub Profile
@angelo510
angelo510 / dropdown.component.html
Created October 14, 2019 16:27
Dropdown Component Angular Template
<mr-field-container
#container
[fieldId]="fieldId"
[label]="label"
[description]="description"
>
<ng-select
*ngIf="hasItems; else staticOptions"
[labelForId]="container.fieldId"
[attr.aria-describedby]="container.descriptionId"
@angelo510
angelo510 / dropdown.component.scss
Created October 14, 2019 16:28
Styles for Dropdown Component (SCSS)
@import "../../app/variables";
:host {
display: block;
min-width: 8rem;
select,
ng-select ::ng-deep .ng-select-container {
width: 100%;
min-height: 2.5rem;
@angelo510
angelo510 / component.ts
Created October 14, 2019 16:43
Example of Angular component for best rxjs practice
import { Component, forwardRef, Input } from "@angular/core";
import { NG_VALUE_ACCESSOR } from "@angular/forms";
import { DateTime } from "luxon";
import { BehaviorSubject, combineLatest, of } from "rxjs";
import { filter, map, shareReplay, startWith, switchMap } from "rxjs/operators";
import { AppointmentsService } from "src/appointments/appointments.service";
import { AppointmentSlot } from "src/appointments/fields/appointment-slot.model";
import { Day } from "src/core/day.model";
import { BaseFieldComponent } from "src/core/forms/base-field.component";
import { SitesService } from "src/core/sites";