You are on page 1of 1

Angularfire2

npm install firebase angularfire2 --save

generate services
=================

ng g s services/tenant

Import in appmodule
===================
firebase imports
----------------
AngularFireModule -- 'angularfire2'
AngularFireDatabase -- angularfire2/database
AngularFireAuth -- 'angularfire2/auth'

tenantservice
-------------

credentials to access firebase


==============================

export const firebaseConfig = {


//.......
}

imports : [ ...., Angularfiremodule.initializeApp(firebaseConfig),....]

//service providers
providers : [AngularFireAuth, AngularFireDatabase, tenantservice]

TenantService.ts
----------------

import angularFireDatabase, firebaseListObservable, FirebaseObjectObservable ---


angularfire2/datbase
import Observable from Rxjs

Client interface -- new model

Construct this service with angularDatabase and


use the service to get the list of tenant from firebase as
firebaseListObservable<Client>

TenantComponent.ts
------------------

construct this component with the tenantService

on Initialization,
invoke the tenantService to get the clients (subscribe to the return value of
tenantservice because it returns an Observable)

add the tenants component in dashboard.template.html

You might also like