Cannot read property 'Items' of null


I am trying to push some data in to Items array but I am getting this error.

here is my code

import { Component,Inject } from ‘@angular/core’;
import { FirebaseApp } from ‘angularfire2’;
import { NavController,AlertController } from ‘ionic-angular’;
import { BarcodeScanner } from ‘ionic-native’;

selector: ‘page-home’,
templateUrl: ‘home.html’
export class HomePage {

data: any;
id: any = 65584;
Items: any;

constructor(public navCtrl: NavController, @Inject(FirebaseApp) firebaseApp: any, public alertCtrl: AlertController) { = firebaseApp.database();
this.Items = [];

public add(){
var ref =“Products/” +;
ref.on(“value”, function(snapshot){
let ItemsObj = {
barcode: snapshot.val().barcode,
name: snapshot.val().name,
price: snapshot.val().price
let alert = this.alertCtrl.create({
title: ‘Failed.’,
subTitle: error.message,
buttons: [‘OK’]



Use fat arrow functions instead of function. Your execution context is unreliable. See here for details.


Can you please help me how to use that fat arrow function in my case