How to use the @angular/fire/database/utils.getRef function in @angular/fire

To help you get started, we’ve selected a few @angular/fire examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github codelab-fun / codelab / libs / feedback / src / lib / feedback.service.ts View on Github external
addRating(lesson: string, rating: string) {
    const path = 'ratings/' + lesson;
    getRef(this.database.database, path).transaction(ratings => {
      if (ratings == null) {
        ratings = {
          lesson: lesson
        };
      }
      const count = ratings[rating] || 0;
      ratings[rating] = count + 1;
      return ratings;
    });
  }
}
github codelab-fun / codelab / src / app / feedback / feedback.service.ts View on Github external
addRating(lesson: string, rating: string) {
    const path = 'ratings/' + lesson;
    getRef(this.database.database, path).transaction(ratings => {
      if (ratings == null) {
        ratings = {
          lesson: lesson
        };
      }
      const count = ratings[rating] || 0;
      ratings[rating] = count + 1;
      return ratings;
    });
  }