0.0.3 • Published 3 years ago

@timfagergren/google-reviews v0.0.3

Weekly downloads
-
License
-
Repository
-
Last release
3 years ago

Prerequisites

  1. Google Maps API
  • The following line must exist in your root index.html file, with a valid API_KEY
    <script src="https://maps.googleapis.com/maps/api/js?libraries=places&key=API_KEY"></script>
  1. Bootstrap
  • We're really only using the col class here, if you want to import just that you can; otherwise
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-giJF6kkoqNQ00vy+HMDP7azOuL0xtbfIcaT9wjKHr8RbDVddVHyTfAAsrekwKmP1" crossorigin="anonymous">
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/js/bootstrap.bundle.min.js" integrity="sha384-ygbV9kiqUc6oa4msXn9868pTtWMgiQaeYH7/t7LECLbyPA2x65Kgf80OJFdroafW" crossorigin="anonymous"></script>

Example

<!doctype html>
<html lang="en">
<head>
  ...
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-giJF6kkoqNQ00vy+HMDP7azOuL0xtbfIcaT9wjKHr8RbDVddVHyTfAAsrekwKmP1" crossorigin="anonymous">
  <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/js/bootstrap.bundle.min.js" integrity="sha384-ygbV9kiqUc6oa4msXn9868pTtWMgiQaeYH7/t7LECLbyPA2x65Kgf80OJFdroafW" crossorigin="anonymous"></script>
  <!-- Requires the following APIs: JavaScript API, Geocoding API, and Places API -->
  <script src="https://maps.googleapis.com/maps/api/js?libraries=places&key=API_KEY"></script>
</head>
...
</html>

Installation

  1. Install package

    npm install @timfagergren/google-reviews
  2. Update app.module.ts

    a. Add the import

    import { GoogleReviewsModule } from '@timfagergren/google-reviews'

    b. Add the module to the imports list

    Result should look something similar to this:

    import { BrowserModule } from '@angular/platform-browser';
    import { NgModule } from '@angular/core';
    
    import { AppComponent } from './app.component';
    import { GoogleReviewsModule } from '../../projects/google-reviews/src/public-api'
    
    @NgModule({
    declarations: [
        AppComponent
    ],
    imports: [
        BrowserModule,
        GoogleReviewsModule
    ],
    providers: [],
    bootstrap: [AppComponent]
    })
    export class AppModule { }

Usage

<lib-google-reviews place_id="ChIJN1t_tDeuEmsRUsoyG83frY4" review_count=3></lib-google-reviews>

Parameters

OptionDescriptionTypeDefaultRequired
place_idPlace ID (find place id)string-true
review_countNumber of reviews to display (between 0 and 5)integer3false
0.0.3

3 years ago

0.0.2

3 years ago