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 { isArray } = Array; | |
| function search(entries: any[], search: string) { | |
| search = search.toLowerCase(); | |
| return entries.filter(function (obj) { | |
| const keys: string[] = Object.keys(obj); | |
| return keys.some(function (key) { | |
| const value = obj[key]; |
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 posts: Post[] = | |
| [ | |
| { | |
| title: "Filtering Objects", | |
| content: "We have an ...", | |
| tags: ['javascript', 'filtering'] | |
| }, | |
| { | |
| title: "Searching an Array of Dates", | |
| content: "We have a text input='11/25/2014'", |
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 { | |
| Resolve, | |
| ActivatedRouteSnapshot, | |
| RouterStateSnapshot } from '@angular/router'; | |
| import { Post } from './post.model'; | |
| import { HttpClient } from '@angular/common/http'; | |
| @Injectable({ | |
| providedIn: 'root' |
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-sidenav #sidenav> | |
| <mat-nav-list> | |
| <a mat-list-item (click)="sidenav.toggle()" *ngFor="let route of routes" [routerLink]="route.path"> {{route.label}}</a> | |
| </mat-nav-list> | |
| </mat-sidenav> |
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
| Type '({ path: string; redirectTo: string; pathMatch: string; } | { path: string; component: typeof HomeComponent; } | { path: string; canActivate: string; component: typeof LoginComponent; })[]' is not assignable to type 'Route[]'. | |
| Type '{ path: string; redirectTo: string; pathMatch: string; } | { path: string; component: typeof HomeComponent; } | { path: string; canActivate: string; component: typeof LoginComponent; }' is not assignable to type 'Route'. | |
| Type '{ path: string; canActivate: string; component: typeof LoginComponent; }' is not assignable to type 'Route'. | |
| Types of property 'canActivate' are incompatible. | |
| Type 'string' is not assignable to type 'any[]'. |
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
| getEmailError() { | |
| if (this.email.hasError('email')) { | |
| return 'Please enter a valid email address.'; | |
| } | |
| if (this.email.hasError('required')) { | |
| return 'An Email is required.'; | |
| } | |
| } |
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
| mdq: MediaQueryList; | |
| mediaQueryListener:()=>void; | |
| constructor( changeDetectorRef: ChangeDetectorRef, media: MediaMatcher ) { | |
| this.mdq = media.matchMedia('(max-width: 992px)'); | |
| this.mediaQueryListener = () => changeDetectorRef.detectChanges(); | |
| this.mdq.addListener(this.mediaQueryListener); | |
| } |
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
| let o1:Observable<boolean> = this.cb1.valueChanges; | |
| let o2:Observable<boolean> = this.cb2.valueChanges; | |
| merge(o1, o2).subscribe( v=>{ | |
| this.columnDefinitions[0].hide = this.cb1.value; | |
| this.columnDefinitions[1].hide = this.cb2.value; | |
| console.log(this.columnDefinitions); | |
| }); | |
| } |
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
| ngAfterViewInit() { | |
| let o1:Observable<boolean> = this.cb1.valueChanges; | |
| let o2:Observable<boolean> = this.cb2.valueChanges; | |
| merge(o1, o2).subscribe( v=>{ | |
| let cb1Value = this.cb1.value; | |
| let cb2Value = this.cb2.value; | |
| this.cbValues = { | |
| cb1: cb1Value, |
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-header-cell { | |
| flex-direction: column; | |
| justify-content: center; | |
| } | |
| .mat-cell { | |
| text-align: center; | |
| justify-content:center; | |
| } |