title: Firestore to get single data from angular
body: <p>I am new in angular. Please help me to get single data from firestore. I am getting full data from database but I need specific data from the database.
  This is my code for angular to get Full Data. I have mentioned two files of code first one is service and another one is to display code.</p>
  
  <p>service.ts</p>
  
  <pre><code>import { Injectable } from '@angular/core';
  import { AngularFirestore,AngularFirestoreDocument,AngularFirestoreCollection } from '@angular/fire/firestore';
  import { User } from '../models/user';
  import { Observable } from 'rxjs';
  import { map } from 'rxjs/operators';
  
  @Injectable({
    providedIn: 'root'
  })
  export class RegisterService {
    private registerCollection : AngularFirestoreCollection&lt;User&gt;;
    private  resgisters : Observable&lt;User[]&gt;;
    private registerDocu : AngularFirestoreDocument&lt;User&gt;;
  
    constructor(public db : AngularFirestore) {
      this.registerCollection = db.collection&lt;User&gt;('Register');
      this.resgisters = db.collection('Register').valueChanges();
  
      this.resgisters = this.registerCollection.snapshotChanges().pipe(
        map(actions =&gt; {
          return actions.map(a =&gt; {
            const data = a.payload.doc.data();
            const id = a.payload.doc.id;
            return { id, ...data };
          });
        })
      );
      }
      addRegister(user: User) {
         this.registerCollection.add(user);
      }
      getRegister(){
        return this.resgisters;
      }
  
  }
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/bqEAA.jpg" alt="firestore image"></p>
  
  <p>Profile.page.ts</p>
  
  <pre><code>import { Component, OnInit } from '@angular/core';
  import { ActivatedRoute } from '@angular/router';
  import { AuthService } from '../../../services/auth.service';
  import { LoggingService } from '../../../services/logging.service';
  import { RegisterService } from '../../../services/register.service';
  import { User } from '../../../models/user';
  
  import * as firebase from 'firebase/app';
  
  @Component({
    selector: 'app-profile',
    templateUrl: './profile.page.html',
    styleUrls: ['./profile.page.scss'],
  })
  export class ProfilePage implements OnInit {
    user : User[];
  
    constructor(private registerservice : RegisterService,private loggingService: LoggingService, private activatedRoute: ActivatedRoute, private authService: AuthService) { }
  
    ngOnInit() {
      this.registerservice.getRegister().subscribe(register =&gt; {
         this.user = register;
         console.log(this.user);
      });      
    } 
  }
  </code></pre>