Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
J javascript-sdk
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • Operations
    • Operations
    • Incidents
  • Analytics
    • Analytics
    • Repository
    • Value Stream
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • rosefire
  • javascript-sdk
  • Issues
  • #3

Closed
Open
Created Jun 09, 2016 by David Fisher@fisherdsOwner

A more Angular 2 specific solution

For the Angular 2 Firebase course we are just going to only create angular-cli apps. At present the only way I know to use Rosefire is via vanilla js. That actually works fine, but it seems like there should be a more elegant angular way to do it. Ideally utilizing AngularFire. So you can assume students have made the app with angular-cli and they are setup to use AngularFire.

To do it today we use vanilla js, and declare a var that exist in the javascript and it works fine, but it seems like there should be a .ts way to do it. Even an

npm install rosefire --save

way to do it instead of the code in our current approach...

import { Injectable, EventEmitter } from '@angular/core';

declare var firebase: any; declare var Rosefire: any;

@Component blah blah blah... export class Name { login() { Rosefire.signIn(this.registryToken, (err, token) => { firebase.auth().signInWithCustomToken(token).catch(this.errorCallback); }); };

logout() { firebase.auth().signOut().catch(this.errorCallback); }; }

Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking