Run Angular 2 on Horizon.io in 5 steps.
This Cookbook is only about setting up Horiozon DEV server with Angular 2 the easiest way.
Horizon.io is built on top of RxJS, so integration with Angular 2 is pretty seamless.
Cookbook is macOS(OS X) only for now and WIP.
- Node.js 4+
- TypeScript 2.1
- Angular CLI
- npm install -g angular-cli@webpack
- https://github.com/angular/angular-cli/
- Horizon.io CLI
- npm install -g horizon
- http://horizon.io/install/
ng new AngularOnHorizon && cd AngularOnHorizon && hz init && npm install && npm install @horizon/client --save
ng g service horizon
nano src/app/horizon.service.ts
// replace file by:
import {Injectable} from '@angular/core';
const Horizon = require('@horizon/client');
@Injectable()
export class HorizonService {
table = Horizon({host: 'localhost:8181'});
}
nano src/app/app.module.ts
// add
import { HorizonService } from './horizon.service';
// replace providers
providers: [HorizonService],
Horizon service can be used now everywhere in your component tree!
hz serve --dev
ng serve & open http://localhost:4200
PR more than welcome!
Refactor app.component.ts