Git Product home page Git Product logo

ionic2firebase3's Introduction

ionic2firebase3

ionic2 simple login with firebase3.0

####Getting Firebase working without the typings

added this code in the index.html file right below the <ion-app> tag

  <ion-app></ion-app>
  <script src="https://www.gstatic.com/firebasejs/3.0.2/firebase.js"></script>

Then in the firebaseService.ts

declare var firebase: any;

to keep the ts compiler from complaining

####Firebase Initialization

You do not need to add this to index.html, copy the information provided to you from the Firebase Getting Started w/Web to the constructor of the library

@Injectable()
export class FirebaseService {

    constructor() {
        // Initialize Firebase
        var config = {
            apiKey: "your-key",
            authDomain: "clearlyinnovative-firebasestarterapp.firebaseapp.com",
            databaseURL: "https://clearlyinnovative-firebasestarterapp.firebaseio.com",
            storageBucket: "clearlyinnovative-firebasestar.appspot.com",
        };
        firebase.initializeApp(config);

##Other Ionic2 Project Repos Integrating ionic2 Google Maps Native Plugin

ionic2firebase3's People

Contributors

aaronksaunders avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ionic2firebase3's Issues

firebase invites?

Hey can you please add an example for firebase dynamic link invites?

Question (not an issue)

Thank you very much for sharing your project ๐Ÿ‘

In firebaseService.ts you have login(credentials) returning an Observable object

login(credentials) {
      var that = this
      return new Observable(observer => {
        return firebase.auth().signInWithEmailAndPassword(credentials.email, credentials.password)
          .then(function (authData) {
              console.log("Authenticated successfully with payload-", authData);
              observer.next(authData)
          }).catch(function (_error) {
              console.log("Login Failed!", _error);
              observer.error(_error)
          })
      });
    }

In my project I had something similar but returning a Promise

login(credentials): Promise<any> {
    return new Promise((resolve: () => void, reject: (reason: Error) => void) => {
      firebase.auth().authWithPassword({"email": credentials.email, "password": credentials.password}, (error: Error) => {
        if (error) {
          console.error('ERROR @ signInWithEmailPassword :', error);
          reject(error);
        }
        else {
          //console.log("Authenticated successfully:", this.authData);
          resolve();
        }
      });
    });
  }

What is the best practice for an ionic app? And when would you use one instead of the other?

(sorry if my questions are stupid but this technology is still a bit foreign to me)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.