Wednesday, February 10, 2016

ANGULARJS 2 - Webinar video of Building Awesome Apps with Firebase and Angular 2

Building Awesome Apps with Firebase and Angular 2

https://www.youtube.com/watch?v=A1dpvZqoM_w


My notes:

Angular 2 Cool features:
https://github.com/angular/angularfire2
https://www.npmjs.com/package/angularfire2

In Angular 1 promises guaranteed that you will receive the response, but only once. Working with Firebase needs response working as STREAMS.

Zones + Change Detection
Zones - Asynchronous execution context. It let you know when the synchronous action are completed. Also Zones will allow to have continuous stack-trace of errors.
Change Detection - will take a look at what is changed and it knows what to do with it.

Pipes
It is like Filters in Angular 1, but now they can manage state.
You can take URL where is your data and pipe it, so that it could be used in your template. When data changes then your its value automatically changes in your template.

Observables
Promises will give you callback just one time. Observables will fire off as a continuous stream, it is like a promises but they continue to fire off.

Installation
npm install --save angularfire2
npm install --save angular-cli

ng new my-awesome-app
cd my-awesome-app
ng serve

1. Instantiate our Firebase URL
For instance AngularfireDemoApp is a component. Everything in Angular 2 is based on Components.

bootstrap(AngularfireDemoApp, [
   defaultFirebase('https://FB-URL.firebase.com'),
   FIREBASE_PROVIDERS
]);

2. Push data to Firebase

return PromiseObservable
    .create(this._fbRef.child('message').push({
        message,
        user
}));


Pipes - transform data as input a desired output

Statless pipes - transform data without remembering or detecting anything about it
Stateful pipes (async) - receive a Promise or Obsorvable as input, maintain a subscription to that

Stateful pipes (async) - example of use Async Pipes in html template:

'<div *ngFor="#message of messages | async"><div>'

sadfsadf



No comments: