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
[ | |
{ | |
"key": "ctrl+;", | |
"command": "workbench.action.terminal.focus" | |
}, | |
{ | |
"key": "ctrl+;", | |
"command": "workbench.action.focusActiveEditorGroup", | |
"when": "terminalFocus" | |
} |
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 { Injectable } from '@angular/core'; | |
import { HttpClient } from '@angular/common/http'; | |
import {LogLevel, LogEntry, ILoggable, ConsoleLog, LocalStorageLog, WebApiLog} from './models/logModels'; | |
import { Observable, of } from 'rxjs'; | |
@Injectable({ | |
providedIn: 'root' | |
}) | |
export class LogService { |
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 { HttpClient, HttpHeaders } from '@angular/common/http'; | |
import { Observable, of } from 'rxjs'; | |
import { timeout, map, catchError } from 'rxjs/operators'; | |
export enum LogLevel { | |
Web = -1, | |
All = 0, | |
Debug = 1, | |
Info = 2, | |
Warn = 3, |
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
{ | |
"name": "con-fusion-app", | |
"version": "0.0.0", | |
"scripts": { | |
"ng": "ng", | |
"start": "ng serve", | |
"build": "ng build", | |
"test": "ng test", | |
"lint": "ng lint", | |
"e2e": "ng e2e" |
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
// Decorator Function | |
function logDec(target: any, key: string, descriptor: any) { | |
// square | |
console.log(key); | |
} | |
class Calculator { | |
// Using the decorator | |
@logDec |
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
// Interfaces are declared with the interface keyword and | |
// contain a series of annotations to describe the contract that they represent. | |
// Interfaces do not result in any compiled JavaScript code | |
// this is due to type erasure | |
// Interfaces are used at design time to provide autocompletion and | |
// at compile time to provide type checking. | |
interface Point { | |
// Properties |
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
function getAverage(a: number, b: number, c: number): string { | |
const total = a + b + c; | |
const average = total / 3; | |
return `The average is: ${average}`; | |
} | |
const result = getAverage(4, 3, 8); | |
console.log(result); |
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
// it is possible to create generic functions, including generic methods, generic interfaces, and generic classes. | |
// Functions | |
// To make a function generic, you add a type parameter enclosed in angle brackets (< >) | |
// immediately after the function name. | |
// When you call a generic function, you can specify the type argument by | |
// placing it in angle brackets after the function name. | |
function reverse<T>(list: T[]) : T[] { |
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
// constructors | |
// All classes in TypeScript have a constructor, whether you specify one or not. | |
// If you leave out the constructor, the compiler will automatically add one. | |
// For a class that doesn't inherit from another class, the automatic constructor will be | |
// parameterless and will initialize any class properties. | |
// Where the class extends another class, the automatic constructor will | |
// match the superclass signature and will pass arguments to the superclass before | |
// initializing any of its own properties. |
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 } from '@angular/core'; | |
import { Model } from './repository.model'; | |
import { Product } from './product.model'; | |
@Component({ | |
selector: 'app-root', | |
templateUrl: './app.component.html', | |
styleUrls: ['./app.component.css'] | |
}) | |
export class AppComponent { |
NewerOlder