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 { from } = require("rxjs"); | |
const fetchData = () => { | |
return from(new Promise((resolve, reject) => { | |
setTimeout(() => { | |
resolve({ id: "abc123", name: "John Rambo" }); | |
}, 2000); | |
}) | |
); | |
} |
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 { from } = require('rxjs'); | |
const { concatMap } = require('rxjs/operators'); | |
const getUserId = () => { | |
return from(['1337']); | |
}; | |
const getUserById = id => { | |
return from([ | |
{ |
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
@Effect() | |
selectItem$ = this.actions$.pipe( | |
ofType(itemAction.ITEM_SELECT), | |
concatMap(() => | |
this.store.select(fromItems.getItemsSelected) | |
), | |
withLatestFrom( | |
this.store.select(fromUi.getItemsSideviewVisible) | |
), | |
filter( |
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
// Return array containing unique item names. | |
return items.reduce( | |
(filteredArray: any, currentItem: Item) => { | |
if (!filteredArray.includes(currentItem.name)) { | |
filteredArray.push(currentItem.name); | |
} | |
return filteredArray; | |
}, | |
[] |
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
this.dynamicComponentService | |
.getLatestComponentStream() | |
.subscribe((component: any) => { | |
if (component) { | |
this.componentStack.push(component); | |
this.createComponent(); | |
} else { | |
this.dynamicComponentsContainerRef.remove( | |
this.componentStack.length - 1 | |
); |
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
export class DynamicComponentService { | |
latestComponent = new BehaviorSubject<any>(null); | |
getLatestComponentStream(): Observable<any> { | |
return this.latestComponent.asObservable(); | |
} | |
pushComponent(component: any): void { | |
this.latestComponent.next(component); | |
} |
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": "MyProject", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"config": { | |
"AWSS3BUCKET": "MyBucket", | |
"AWSPROFILE": "personal", | |
"AWSREGION": "eu-north-1", | |
"AWSSTACK": "MyStack" |
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
AWSTemplateFormatVersion: '2010-09-09' | |
Transform: 'AWS::Serverless-2016-10-31' | |
Description: 'My test serverless API' | |
Parameters: | |
BucketName: | |
Type: String | |
CodeKey: | |
Type: String | |
StackName: | |
Type: String |
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'; | |
@Component({ | |
selector: 'app-paginator', | |
template: ` | |
<div *ngFor="let item of items | slice:(page*itemsPerPage):(page*itemsPerPage+itemsPerPage)"> | |
{{ item.title }} | |
</div> | |
<button [disabled]="page == 0" (click)="onPreviousClick()">previous page</button> |
OlderNewer