npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

angular-google-signin

v0.1.5

Published

Google Sign-In component for Angular written in TypeScript

Downloads

247

Readme

angular-google-signin npm version

Google Sign-In component for Angular written in TypeScript.

Usage

Add this script tag below in the head tag of index.html:

<script defer src="https://apis.google.com/js/platform.js"></script>

Import and add GoogleSignInComponent from this package to your Angular module:

import {NgModule} from '@angular/core';
import {BrowserModule} from '@angular/platform-browser';

import {AppComponent} from './app.component';
import {GoogleSignInComponent} from 'angular-google-signin';

@NgModule({
  imports: [
    BrowserModule
  ],
  declarations: [
    AppComponent,
    GoogleSignInComponent
  ],
  bootstrap: [AppComponent]
})
export class AppModule {
}

Example of a component that is using this package:

import {Component} from '@angular/core';
import {GoogleSignInSuccess} from 'angular-google-signin';

@Component({
  selector: 'my-app',
  templateUrl: 'app.component.html'
})
export class AppComponent {
  constructor() {
  }

  private myClientId: string = 'your-client-id-here.apps.googleusercontent.com';

  onGoogleSignInSuccess(event: GoogleSignInSuccess) {
    let googleUser: gapi.auth2.GoogleUser = event.googleUser;
    let id: string = googleUser.getId();
    let profile: gapi.auth2.BasicProfile = googleUser.getBasicProfile();
    console.log('ID: ' +
      profile
        .getId()); // Do not send to your backend! Use an ID token instead.
    console.log('Name: ' + profile.getName());
  }
}

In a component template, put <google-signin> with attributes of render options and init params. clientId attribute is required. You don't need to write google-signin-client_id meta tag.

<google-signin
  [clientId]="myClientId"
  [width]="myWidth"
  [theme]="myTheme"
  [scope]="myScope"
  [longTitle]="myLongTitle"
  (googleSignInSuccess)="onGoogleSignInSuccess($event)">
</google-signin>

For more information about Google Sign-In JavaScript client, See https://developers.google.com/identity/sign-in/web/sign-in

Features and bugs

Please file feature requests and bugs at the issue tracker.

Notes

This package is a modification and rewriting of original work by @ntaoo https://github.com/ntaoo/ng2_g_signin/.

Thanks @ntaoo for an idea and a component design 👍