'Query a Firestore Collection using Angular Fire & Angular Js

I need to query the data from the firestore collection in Angularjs.

I already get the data from firestore using this code in the vanilla javascript.

import { getFirestore, doc, getDoc,getDocs, collection } from "https://www.gstatic.com/firebasejs/9.6.9/firebase-firestore.js";

const db = getFirestore();
 const snap =   await getDoc(doc(db, 'collectionname', 'docID'));

But I need to use this code in the angular js controller. I have already added the angular fire file. If I add the import file in the angular js file getting an error. In angular fire docs, I did not see any methods.

Controller

var app = angular.module('App', ['firebase']);
app.controller('MainController', function ($scope,$firebaseObject) {
 const db = firebase.Firestore();
 console.log(db);
 const db = $firebaseObject.Firestore();
  console.log(db);
});

try both ways to access firestore but no luck.

I added the CDN link of firestore, firebase, angular fire.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source