Skip to content

Instantly share code, notes, and snippets.

@thrixton
thrixton / app.component.ts
Created November 16, 2018 04:48
app.component.ts
// In app.component or relevant component requiring icon
import { faGoogle } from '@fortawesome/free-brands-svg-icons';
/*...*/
constructor(
_iconService: IconService
) {
_iconService.addSvg(faGoogle); // add icon to library
}
@thrixton
thrixton / icon.service.ts
Created November 16, 2018 04:47
icon.service.ts
import { Injectable } from '@angular/core';
import { MatIconRegistry } from '@angular/material';
import { DomSanitizer } from '@angular/platform-browser';
import { IconDefinition } from '@fortawesome/fontawesome-svg-core';
@Injectable({
providedIn: 'root'
})
export class IconService {
constructor(private _iconRegistry: MatIconRegistry, private _sanitizer: DomSanitizer) {}
@thrixton
thrixton / tslint.json
Last active November 15, 2018 01:03
Prettier tslint.json
{
"rulesDirectory": ["node_modules/codelyzer"],
"rules": {
"arrow-return-shorthand": true,
"callable-types": true,
"class-name": true,
"deprecation": {
"severity": "warn"
},
"forin": true,
{
"rules": {
"arrow-return-shorthand": true,
"callable-types": true,
"class-name": true,
"deprecation": {
"severity": "warn"
},
"forin": true,
"interface-over-type-literal": true,
{
"rules": {
"arrow-return-shorthand": true,
"callable-types": true,
"class-name": true,
"deprecation": {
"severity": "warn"
},
"forin": true,
"interface-over-type-literal": true,
{
"printWidth": 120,
"singleQuote": true,
"useTabs": false,
"tabWidth": 2,
"semi": true,
"bracketSpacing": true
}
@thrixton
thrixton / key-value.pipe.ts
Created December 21, 2017 21:50 — forked from bombadillo/key-value.pipe.ts
Angular 2 Key Value Pipe
import { Pipe, PipeTransform } from '@angular/core';
/*
* Enables the key/value pair of an item to be
* visible within an ngFor
* Usage:
* value of iteratable | keyValue
* Example:
* <ul>
* <li *ngFor='key of demo | keyValue'>
import { Injectable } from '@angular/core';
import { AppConfig } from '../app.config';
import {UserAgentApplication} from 'msal';
@Injectable()
export class MsalService {
accessToken: string;
userAgentApplication: UserAgentApplication = null;
constructor() {
this.userAgentApplication = new UserAgentApplication(