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 abstract class ResourceAccessor : MarkupExtension | |
{ | |
private static readonly IDictionary<Type, Uri> UriCache = new Dictionary<Type, Uri>(); | |
public Uri Uri | |
{ | |
get | |
{ | |
var result = GetUriWithCache(); |
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; |
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
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
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 { 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 { | |
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 { 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"> |
OlderNewer