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
type Vehicle = IMotorcycle | ICar | ITruck; |
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
const evaluationFactor = Math.PI; // some global factor | |
function evaluatePrice(vehicle: Vehicle) { | |
return vehicle.capacity * evaluationFactor; | |
} | |
const myTruck: ITruck = {vType: "truck", capacity: 9.5}; | |
evaluatePrice(myTruck); |
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 evaluatePrice(vehicle: Vehicle) { | |
switch(vehicle.vType) { | |
case "car": | |
return vehicle.transmission * evaluationFactor; | |
case "truck": | |
return vehicle.capacity * evaluationFactor; | |
case "motorcycle": | |
return vehicle.make * evaluationFactor; | |
} | |
} |
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
interface IBicycle { | |
vType: "bicycle"; | |
make: number; | |
} | |
type Vehicle = IMotorcycle | ICar | ITruck | IBicycle; |
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 evaluatePrice(vehicle: Vehicle) { | |
switch(vehicle.vType) { | |
case "car": | |
return vehicle.transmission * evaluationFactor; | |
case "truck": | |
return vehicle.capacity * evaluationFactor; | |
case "motorcycle": | |
return vehicle.make * evaluationFactor; | |
default: | |
const invalidVehicle: never = vehicle; |
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 evaluatePrice(vehicle: Vehicle) { | |
switch(vehicle.vType) { | |
case "car": | |
return vehicle.transmission * evaluationFactor; | |
case "truck": | |
return vehicle.capacity * evaluationFactor; | |
case "motorcycle": | |
return vehicle.make * evaluationFactor; | |
case "bicycle": | |
return vehicle.make * evaluationFactor; |
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
<!-- USAGE --> | |
<!-- Transoforming strings --> | |
<div class="users"> | |
<div class="users__user" *ngFor="let user of users"> | |
{{user.name | appTitleCase}} | |
</div> | |
</div> | |
<!-- Transforming Arrays --> |
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
/* You can add global styles to this file, and also import other style files */ | |
.cdk-overlay-container { | |
display: block; | |
&.z-index-top { | |
z-index: 2050; | |
} | |
} | |
.duplicate-modal-overlay { |
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 { AfterViewInit, ChangeDetectorRef, Directive, Input, Renderer2, SimpleChanges } from '@angular/core'; | |
@Directive({ | |
selector: '[appPopoverPositionalClass]' | |
}) | |
export class PopoverPositionalClassDirective implements AfterViewInit { | |
@Input() originY: string; | |
@Input() targetSelector: string; | |
@Input() inverseClass; | |
@Input() initialDirection = 'bottom'; |
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
/** | |
Replace the "<DOCID>" with your document ID, or the entire URL per say. Should be something like: | |
var EMAIL_TEMPLATE_DOC_URL = 'https://docs.google.com/document/d/asdasdakvJZasdasd3nR8kmbiphqlykM-zxcrasdasdad/edit?usp=sharing'; | |
*/ | |
var EMAIL_TEMPLATE_DOC_URL = 'https://docs.google.com/document/d/<DOCID>/edit?usp=sharing'; | |
var EMAIL_SUBJECT = 'This is an important email'; | |
/** | |
* Sends a customized email for every response on a form. |