This file contains hidden or 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 { Injectable } from '@angular/core'; | |
import { MatSnackBar } from '@angular/material/snack-bar'; | |
import { SwUpdate } from '@angular/service-worker'; | |
@Injectable() | |
export class UpdateService { | |
constructor(private swUpdate: SwUpdate, | |
private snackbar: MatSnackBar) { | |
this.swUpdate.available.subscribe(event => { |
This file contains hidden or 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 { FormControl } from "@angular/forms"; | |
export function noWhitespaceValidator(control: FormControl) { | |
const isWhitespace = (control.value || '').trim().length === 0; | |
const isValid = !isWhitespace; | |
return isValid ? null : { 'whitespace': true }; | |
} |
This file contains hidden or 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 { Injectable, Inject } from '@angular/core'; | |
import { BehaviorSubject, Observable } from 'rxjs'; | |
import { TranslateService } from '@ngx-translate/core'; | |
import { DOCUMENT } from '@angular/common'; | |
@Injectable({ | |
providedIn: 'root' | |
}) | |
export class LanguageService { | |
private readonly DEFAULT_LANGUAGE = 'en'; |
This file contains hidden or 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
<input type="text" autocomplete="off" autocomplete="chrome-off"> |
This file contains hidden or 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
<!-- keep it as text to hide arrow up and down --> | |
<!-- user can add negative numbers if type number --> | |
<input type="text" positiveNumbers> |
This file contains hidden or 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 id="print-section"> | |
<!-- template here --> | |
</div> |
This file contains hidden or 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
<mat-option *ngFor="let value of list | filter:searchKeywords" [value]="value.id" matTooltip="{{value.name}}"> | |
{{value.name}} | |
</mat-option> |
This file contains hidden or 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
<form [formGroup]="form"> | |
<div formArrayName="students" *ngFor="let student of students.controls; let index = index; let last = last"> | |
<mat-card [formGroupName]="index"> | |
<mat-card-title> | |
<p>student #{{index + 1}}</p> | |
<mat-icon (click)="removeStudent()" class="remove">delete</mat-icon> | |
</mat-card-title> | |
<mat-card-content> | |
<mat-form-field> |
This file contains hidden or 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 { Injectable } from '@angular/core'; | |
import { HttpClient } from '@angular/common/http'; | |
import { Observable } from 'rxjs'; | |
@Injectable({ | |
providedIn: 'root' | |
}) | |
export class SearchService { | |
private static readonly endpoint = 'https://nominatim.openstreetmap.org/search?format=json'; |
This file contains hidden or 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
const settings: Settings = { | |
backendUrl: 'http://...', | |
}; |