By: @BTroncone
Also check out my lesson @ngrx/store in 10 minutes on egghead.io!
Update: Non-middleware examples have been updated to ngrx/store v2. More coming soon!
Table of Contents
| import {Injectable, EventEmitter} from 'angular2/core'; | |
| @Injectable() | |
| export class EmitterService { | |
| private static _emitters: { [ID: string]: EventEmitter<any> } = {}; | |
| static get(ID: string): EventEmitter<any> { | |
| if (!this._emitters[ID]) | |
| this._emitters[ID] = new EventEmitter(); | |
| return this._emitters[ID]; |
By: @BTroncone
Also check out my lesson @ngrx/store in 10 minutes on egghead.io!
Update: Non-middleware examples have been updated to ngrx/store v2. More coming soon!
Table of Contents
| import {PipeTransform, Pipe} from 'angular2/core'; | |
| @Pipe({ name: 'highlight' }) | |
| export class HighLightPipe implements PipeTransform { | |
| transform(text: string, [search]): string { | |
| return search ? text.replace(new RegExp(search, 'i'), `<span class="highlight">${search}</span>`) : text; | |
| } | |
| } | |
| /** Usage: |
Clone the starter repo AngularClass/angular2-webpack-starter and then cd into your local directory.
Install angular2-esri-loader
npm install angular2-esri-loader --save
# optional, if you want type support in your IDE for JSAPI 4.x
npm install @types/arcgis-js-api --save-devNOTE: These instructions apply to trying to use the ArcGIS API for JavaScript in an Angular 2 application created w/ angular-cli. If you're working with more recent versions of Angular, you should use https://github.com/Esri/esri-loader instead.
Create a new Angular app by using angular-cli to generate a new project
Install angular2-esri-loader
npm install angular2-esri-loader esri-loader --save| import { Injectable } from '@angular/core'; | |
| import { HttpClient } from '@angular/common/http'; | |
| import { Observable } from 'rxjs'; | |
| import { map, publishReplay, refCount } from 'rxjs/operators'; | |
| export interface Config { | |
| componentType: string, | |
| show: Boolean | |
| } |