Skip to content

Instantly share code, notes, and snippets.

View wesleygrimes's full-sized avatar

Wes Grimes wesleygrimes

View GitHub Profile
import { CommonModule } from '@angular/common';
import {
NgModule,
NgModuleFactoryLoader,
SystemJsNgModuleLoader
} from '@angular/core';
import { DynamicContentOutletErrorComponent } from './dynamic-content-outlet-error.component';
import { DynamicContentOutletComponent } from './dynamic-content-outlet.component';
import { DynamicContentOutletService } from './dynamic-content-outlet.service';
import {
Component,
ComponentRef,
Input,
OnChanges,
OnDestroy,
ViewChild,
ViewContainerRef
} from '@angular/core';
import { DynamicContentOutletService } from './dynamic-content-outlet.service';
import { Component, Input } from '@angular/core';
@Component({
selector: 'app-dynamic-content-outlet-error-component',
template: `
<div>{{ errorMessage }}</div>
`
})
export class DynamicContentOutletErrorComponent {
@Input() errorMessage: string;
@wesleygrimes
wesleygrimes / angular-dynamic-aot-gist-service.ts
Last active February 28, 2019 19:26
Dynamic Content Outlet Service
import {
ComponentFactoryResolver,
ComponentRef,
Injectable,
Injector,
NgModuleFactoryLoader,
Type
} from '@angular/core';
import { DynamicContentOutletErrorComponent } from './dynamic-content-outlet-error.component';
import { DynamicContentOutletRegistry } from './dynamic-content-outlet.registry';
@wesleygrimes
wesleygrimes / recommend-vscode-angular-debug-launch.json
Created November 27, 2018 13:49
Recommended .vscode/launch.json for debugging angular applications
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug App",
"type": "chrome",
"request": "launch",
"url": "http://localhost:4200",
"sourceMaps": true,
"webRoot": "${workspaceRoot}/src",
@wesleygrimes
wesleygrimes / recommend-vs-code-settings.json
Created November 27, 2018 13:45
Recommended VS Code Settings.json
{
"workbench.iconTheme": "material-icon-theme",
"window.zoomLevel": 1,
"editor.formatOnSave": true,
"prettier.singleQuote": true,
"prettier.eslintIntegration": true,
"prettier.tabWidth": 2,
"typescript.updateImportsOnFileMove.enabled": "always",
"editor.codeActionsOnSave": {
"source.organizeImports": true
@wesleygrimes
wesleygrimes / example-container.component.ts
Created May 30, 2018 19:20
Example Container Component
import { Component, OnInit } from '@angular/core';
import { Store } from '@ngrx/store';
import { Observable } from 'rxjs';
import { MyModel } from '../../models';
import {
RootStoreState,
MyFeatureStoreActions,
MyFeatureStoreSelectors
} from '../../root-store';
@wesleygrimes
wesleygrimes / index.ts
Created May 30, 2018 19:15
Root Store Module - Barrel Export
import { RootStoreModule } from './root-store.module';
import * as RootStoreSelectors from './selectors';
import * as RootStoreState from './state';
export * from './my-feature-store';
export * from './my-other-feature-store';
export { RootStoreState, RootStoreSelectors, RootStoreModule };
@wesleygrimes
wesleygrimes / selectors.ts
Last active November 29, 2018 15:35
Root Selectors
import { createSelector, MemoizedSelector } from '@ngrx/store';
import {
MyFeatureStoreSelectors
} from './my-feature-store';
import {
MyOtherFeatureStoreSelectors
} from './my-other-feature-store';
export const selectError: MemoizedSelector<object, string> = createSelector(
@wesleygrimes
wesleygrimes / root-store-module.ts
Last active May 31, 2018 15:21
Root Store Module
import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { EffectsModule } from '@ngrx/effects';
import { StoreModule } from '@ngrx/store';
import { MyFeatureStoreModule } from './my-feature-store/';
import { MyOtherFeatureStoreModule } from './my-other-feature-store/';
@NgModule({
imports: [
CommonModule,