Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Firebase & Angular

Firebase & Angular

Ciro Nunes

August 10, 2016
Tweet

More Decks by Ciro Nunes

Other Decks in Programming

Transcript

  1. 1. Creating the app and uploading images 3. Deploying the

    app 2. Exploring the realtime database
  2. 1. Creating the app and uploading images 3. Deploying the

    app 2. Exploring the realtime database
  3. 1. Creating the app and uploading images 3. Deploying the

    app 2. Exploring the realtime database
  4. CLI

  5. ~ $ npm install -g firebase-tools CLI ~ ~ $

    firebase init # start a new project
  6. ~ $ npm install -g firebase-tools CLI ~ ~ $

    firebase init ~ $ firebase deploy
  7. <input type="text" id="message-field"> <h2>Hello, <span id="message-text"></span><h2> var $messageField = document.querySelector('#message-field')

    var $messageText = document.querySelector('#message-text') $messageField.value = 'Ciro' $messageText.innerText = 'Ciro' $messageField.addEventListener('keyup', function(e) { $messageText.innerText = e.target.value }, false) DATA BINDING http://jsbin.com/hayiyuyeve/edit?html,js,output
  8. DATA BINDING @Component({ selector: 'my-greeting', template: ` <input type="text" [(ngModel)]="hero.name">

    <h2>Hello, {{hero.name}}</h2> `, }) export class Greeting { constructor() { this.hero = { name: 'Ciro' } } } http://plnkr.co/edit/MGnF3Ta5IOPYYAyXjFpl?p=preview
  9. import { AngularFireModule } from 'angularfire2'; ... @NgModule({ imports: [

    AngularFireModule.initializeApp( firebaseConfig, firebaseAuthConfig ) ] })
  10. const firebaseConfig = { apiKey: "...", authDomain: "...", databaseURL: "...",

    storageBucket: "..." }; const firebaseAuthConfig = { provider: AuthProviders.Facebook, method: AuthMethods.Popup };
  11. user = null; constructor(private af: AngularFire) { this.af.auth .subscribe(user =>

    {...}); } login() { this.af.auth.login(); } logout() { this.af.auth.logout(); }