0.0.3 • Published 3 years ago
@timfagergren/google-reviews v0.0.3
Prerequisites
- Google Maps API
- The following line must exist in your root
index.html
file, with a validAPI_KEY
<script src="https://maps.googleapis.com/maps/api/js?libraries=places&key=API_KEY"></script>
- 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
Install package
npm install @timfagergren/google-reviews
Update
app.module.ts
a. Add the import
import { GoogleReviewsModule } from '@timfagergren/google-reviews'
b. Add the module to the
imports
listResult 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
Option | Description | Type | Default | Required |
---|---|---|---|---|
place_id | Place ID (find place id) | string | - | true |
review_count | Number of reviews to display (between 0 and 5) | integer | 3 | false |