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 functions = require('firebase-functions'); | |
const admin = require('firebase-admin'); | |
const db = admin.firestore(); | |
exports.updateMyCollectionCount = functions.firestore | |
.document(`users/{userId}/my-collection/{itemId}`) | |
.onWrite(event => { | |
const isUpdate = event.data.exists && event.data.previous.exists; |
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 { Observable } from 'rxjs/Observable'; | |
import { SharedData } from '../shared-data'; | |
@Component({ | |
selector: 'app-main', | |
template: ` | |
<button (click)="loadData()">Load data</button> | |
<div *ngIf="sharedData.value | async; let data"> |
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 { | |
ApplicationRef, Componenimport { | |
ApplicationRef, ComponentFactoryResolver, ComponentRef, | |
Injectable, Injector, Type, ViewContainerRef | |
} from '@angular/core'; | |
import { | |
ComponentType, | |
Portal, | |
ComponentPortal, |
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 { ComponentFactoryService } from './component-factory.service'; | |
import { DynamicComponent } from './dynamic.component'; | |
@Component({ | |
selector: 'app-home', | |
template: '<div #host></div>' | |
}) | |
export class HomeComponent { | |
@ViewChild('host', {read: ViewContainerRef}) |
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 { BrowserModule } from '@angular/platform-browser'; | |
import { NgModule } from '@angular/core'; | |
import { AppComponent } from './app.component' | |
import { DynamicComponent } from './dynamic.component'; | |
import { ComponentFactoryService } from './component-factory.service'; | |
@NgModule({ | |
declarations: [ | |
AppComponent, |
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 { | |
ApplicationRef, ComponentFactoryResolver, ComponentRef, | |
EmbeddedViewRef, Injectable, Injector, Type, ViewContainerRef | |
} from '@angular/core'; | |
@Injectable() | |
export class ComponentFactoryService { | |
constructor( | |
private cfr: ComponentFactoryResolver, |
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 CommonsChunkPlugin = require('webpack/lib/optimize/CommonsChunkPlugin'); | |
const HtmlWebpackPlugin = require('html-webpack-plugin'); | |
const apps = [ | |
{ | |
name: 'app1', | |
baseUrl: '/app1' | |
}, | |
{ | |
name: 'app2', |
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
public static class AsyncRetry | |
{ | |
public static async Task DoAsync(Func<Task> action, | |
AsyncRetryPolicy policy = null, | |
CancellationToken? cancellationToken = null) | |
{ | |
await DoAsync(async () => | |
{ | |
await action(); | |
return true; |
NewerOlder