title: How to take data from last entry on firebase realtime chat
body: <p>I added chat on my project. I use firebase realtime database.</p>
  
  <p>But I don’t want to take all data on database , I would like to take data from last entry like whatsapp.</p>
  
  <p>how can I do this?</p>
  
  <p>I take data with this code;</p>
  
  <pre><code> messages: object[] = [];
   _chatSubscription;
  
    constructor(public navCtrl: NavController, public navParams: NavParams,public db: AngularFireDatabase,public camera:Camera,private imagePicker:ImagePicker,
      public cropService: Crop,public translate: TranslateService,private toastCtrl: ToastController) {
      this.username = this.navParams.get('username');
      this._chatSubscription = this.db.list('/'+this.navParams.get("chatid")).subscribe( data =&gt; {
        this.messages = data;
      });
    }
  </code></pre>
  
  <p>Thanks , have a nice day.</p>