View model.ts
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 type Book = { | |
id: string; | |
volumeInfo: { | |
title: string; | |
subtitle: string; | |
authors: string[]; | |
publisher: string; | |
publishDate: string; | |
description: string; | |
averageRating: number; |
View search.ts
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
constructor(private http: HttpClient) { | |
this.bookStore.observeQuery().pipe(filter(Boolean), | |
debounceTime(200), | |
distinctUntilChanged(), | |
tap(async (query: string) => { | |
const bo: Observable<Book[]> = this.searchAPI(query); | |
const books: Book[] = await bo.toPromise(); | |
this.bookStore.reset(); | |
this.bookStore.postA(books); | |
}) |
View material-slice.ts
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 { NgModule } from '@angular/core'; | |
import { | |
MatInputModule, | |
MatCardModule, | |
MatButtonModule, | |
MatSidenavModule, | |
MatListModule, | |
MatIconModule, | |
MatToolbarModule, |
View ts.ts
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
const isActiveTodoInCollection$:Observable<boolean> = | |
combineLatest(active$, | |
collection$, | |
(a, c)=>{ | |
if (getMapValue(central.active)) { | |
return collection.containsById(getMapValue(central.active)); | |
} | |
return false; | |
}); |
View pt.ts
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, Input } from '@angular/core'; | |
import { Book } from '../model/'; | |
@Component({ | |
selector: 'bc-book-authors', | |
template: ` | |
<h5 mat-subheader>Written By:</h5> | |
<span> | |
{{ authors | bcAddCommas }} | |
</span> |
View rxjs.ts
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
ngAfterViewInit() { | |
// server-side search | |
fromEvent(this.input.nativeElement,'keyup') | |
.pipe( | |
untilDestroyed(this), | |
filter(Boolean), | |
debounceTime(150), | |
distinctUntilChanged(), | |
tap(async (event:KeyboardEvent) => { | |
console.log(`The input value is ${this.input.nativeElement.value}`); |
View toolbar.ts
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, Output, EventEmitter } from '@angular/core'; | |
@Component({ | |
selector: 'fs-toolbar', | |
template: ` | |
<mat-toolbar color="primary"> | |
<button mat-icon-button (click)="openMenu.emit()"> | |
<mat-icon>menu</mat-icon> | |
</button> | |
<ng-content></ng-content> |
View gist:a70c1e455cde8a986bc79b6e3477cd49
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
const googleLogoURL = | |
"https://raw.githubusercontent.com/fireflysemantics/logo/master/Google.svg"; | |
@Component({ | |
selector: 'my-app', | |
templateUrl: './app.component.html', | |
styleUrls: [ './app.component.css' ] | |
}) | |
export class AppComponent { | |
constructor ( |
View console.ts
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 Console { | |
textarea: HTMLTextAreaElement; | |
constructor(container: HTMLElement) { | |
this.textarea = document.createElement("textarea"); | |
container.appendChild(this.textarea); | |
} | |
/** | |
* @param | |
*/ | |
log(message: string, type?: string) { |
View input.ts
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
const postCategories: PostCategory[] = [ | |
{ | |
id: "iot", | |
name: "IOT", | |
summary: "Internet of Things Posts.", | |
posts: [ | |
{ | |
id: "thermostat", | |
title: "Thermostat", | |
content: "How to make it really cold fast!" |
NewerOlder