Skip to content

Instantly share code, notes, and snippets.

1. in module provider
{ provide: APP_CONFIG, useValue: AppConfig }
2. app.config.ts
import { InjectionToken } from "@angular/core";
import { IAuthConfig } from "../service/Authentication/auth.config";
import { environment } from 'src/environments/environment';
1. Right Clicked on My Computer (windows)
2. Selected Advanced System Settings
3. Clicked "Environment Variables"
4. Under "Path" variable, made the FIRST value listed %AppData%\npm
***Component:
import { ComponentCanDeactivate } from './pending-changes.guard';
import { HostListener } from '@angular/core';
import { Observable } from 'rxjs/Observable';
export class MyComponent implements ComponentCanDeactivate {
// @HostListener allows us to also guard against browser refresh, close, etc.
@HostListener('window:beforeunload')
canDeactivate(): Observable<boolean> | boolean {
ngAfterViewInit() {
setTimeout(() => {
});
}
Pipe File:
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'TableFilterMultiple'
})
export class TablefilterMultiplePipe implements PipeTransform {
transform(items: any[], fields: any[], value: string): any[] {
<html>
<head>
<style>
body {
font-family: 'Segoe UI' !important;
width: 900px;
margin: 0 auto;
background-color: #E7E6E3;
padding: 15px;
Request.Headers.TryGetValue("some-header-name", out var headers);
if(headers.Count > 1 || string.IsNullOrWhiteSpace(headers.FirstOrDefault())){
return new UnauthorizedResult();
}
import { Component, Inject, ViewChild } from '@angular/core';
import { DOCUMENT } from '@angular/common';
import { MatAutocompleteTrigger } from '@angular/material';
@Component({
...
template: `
<input
autocomplete="address-level1"
(input)="onInput($event)"
import { Directive, ElementRef, HostListener } from '@angular/core';
import { Router } from '@angular/router';
@Directive({
selector: '[routeTransformer]'
})
export class RouteTransformerDirective {
constructor(private el: ElementRef, private router: Router) { }