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
| export class Filters { | |
| public readonly format = 'JSON'; | |
| constructor( | |
| public zone: 'ASI' | 'EUR' | 'USA', | |
| public currency: 'EUR' | 'USD', | |
| public userId: number | |
| ) { } | |
| } |
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
| function removeDuplicates(arr) { | |
| return arr.reduce((acc, cur) => { | |
| if(acc.indexOf(cur) === -1) acc.push(cur); | |
| return acc; | |
| }, []); | |
| } |
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
| function removeDuplicates(arr) { | |
| return [...new Set(arr)]; | |
| } |
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 shape = { | |
| radius: 10, | |
| diameter() { | |
| return this.radius * 2; | |
| }, | |
| perimeter: () => 2 * Math.PI * this.radius | |
| }; | |
| console.log(shape.diameter()); | |
| console.log(shape.perimeter()); |
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 { Component} from '@angular/core'; | |
| @Component({ | |
| selector: 'app-child', | |
| template: `<h1>I am the child</h1>` | |
| }) | |
| export class ChildComponent { | |
| message = 'Hey there from the child!'; | |
| constructor() { } | |
| } |
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 { Component, Output, EventEmitter } from '@angular/core'; | |
| @Component({ | |
| selector: 'app-child', | |
| template: ` | |
| <button (click)="sendMessage()">Send Message</button> | |
| ` | |
| }) | |
| export class ChildComponent { | |
| message: string = "Hey there from the child!"; |
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 { Component, OnInit } from '@angular/core'; | |
| import { DataService } from "./data.service"; | |
| @Component({ | |
| selector: 'app-sibling', | |
| template: ` | |
| {{message}} | |
| <button (click)="newMessage()">New Message</button> | |
| ` | |
| }) |
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 { Directive, ElementRef, OnInit, Input } from '@angular/core'; | |
| import { OverlayRef } from '@angular/cdk/overlay'; | |
| import { DynamicOverlay } from '@app/third-parties/angular-material/dynamic-overlay'; | |
| import { Observable } from 'rxjs'; | |
| import { ComponentPortal } from '@angular/cdk/portal'; | |
| import { LoaderComponent } from './loader/loader.component'; | |
| @Directive({ | |
| selector: '[overlayLoading]' | |
| }) |
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 { Component } from '@angular/core'; | |
| import { Overlay } from '@angular/cdk/overlay'; | |
| import { ComponentPortal } from '@angular/cdk/portal'; | |
| import { LoaderComponent } from './loader/loader.component'; | |
| @Component({ | |
| selector: 'app-root', | |
| template: | |
| `<mat-card> | |
| <mat-card-header> |
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 { Component } from '@angular/core'; | |
| @Component({ | |
| selector: 'app-loader', | |
| template: | |
| `<mat-card> | |
| <mat-card-header> | |
| <mat-card-title> | |
| Fetching data... | |
| </mat-card-title> |