Skip to content

otodockal/angular-on-horizon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 

Repository files navigation

Angular on Horizon

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.

PREREQUISITES

Table of Contents

macOS (OSX)

1. Open terminal

ng new AngularOnHorizon && cd AngularOnHorizon && hz init && npm install && npm install @horizon/client --save

2. Create Horizon service

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'});
}

3. Inject Horizon service

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!

4. Run Horizon (dedicated terminal)

hz serve --dev

5. Run Angular app (dedicated terminal)

ng serve & open http://localhost:4200

Windows

PR more than welcome!

EXAMPLE

Refactor app.component.ts

About

Run Angular 2 on Horizon.io in 5 steps.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published