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
var x = 5; | |
x = "Hello"; |
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 cowsay = require("cowsay"); | |
console.log(cowsay.say({ | |
text : "From Zero To Somewhere", | |
e : "oO", | |
T : "U " | |
})); |
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": "test", | |
"version": "1.0.0", | |
"main": "index.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"keywords": [], | |
"author": "", | |
"license": "ISC", |
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
console.log('Hello'); |
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
<ngs-container [query$]="query$" | |
[data$]="pokemons$"> | |
<ng-template let-pokemons> | |
<div *ngFor="let p of pokemons; trackBy: trackByValue">{{ p.name }}</div> | |
</ng-template> | |
</ngs-container> |
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 { NgFor } from '@angular/common'; | |
import { ChangeDetectionStrategy, Component, inject, TrackByFunction } from '@angular/core'; | |
import { NgStore, NgStoreModule, trackByValue } from '@ssougnez/ng-store'; | |
import { map, Observable } from 'rxjs'; | |
import { Pokemon } from './models/pokemon.model'; | |
import { PokemonService } from './services/pokemon.service'; | |
import { AppState } from './state/app.state'; | |
@Component({ | |
selector: 'app-root', |
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 { inject, Injectable } from "@angular/core"; | |
import { NgStore } from "@ssougnez/ng-store"; | |
import { Observable } from "rxjs"; | |
import { Pokemon } from "../models/pokemon.model"; | |
import { AppState } from "../state/app.state"; | |
@Injectable({ | |
providedIn: 'root' | |
}) | |
export class PokemonService { |
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 { createEntities, Entities } from "@ssougnez/ng-store"; | |
import { Pokemon } from "../models/pokemon.model"; | |
export type AppState = { | |
pokemons: Entities<Pokemon>; | |
} | |
export const initial: AppState = { | |
pokemons: createEntities<Pokemon>([], ['type']) | |
} |
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 { BaseEntity } from "@ssougnez/ng-store"; | |
export type Pokemon = BaseEntity<number> & { | |
name: string; | |
type: 'water' | 'fire' | 'electric' | 'grass' | 'bug' | 'normal' | 'poison'; | |
} |
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
if (element.tagName === 'A') { | |
const href: string = element.href?.toLowerCase(); | |
if (href?.startsWith(location.origin.toLowerCase())) { | |
element.addEventListener('click', (e: MouseEvent) => { | |
this._router.navigate([href.substring(location.origin.length)]); | |
e.preventDefault(); | |
}); | |
} | |
} |
NewerOlder