Skip to content

Instantly share code, notes, and snippets.

@angular-academy-devs
Last active August 15, 2017 10:36
Show Gist options
  • Save angular-academy-devs/bc7e557ba3d8e87ee93ab037f84bc21d to your computer and use it in GitHub Desktop.
Save angular-academy-devs/bc7e557ba3d8e87ee93ab037f84bc21d to your computer and use it in GitHub Desktop.
import {FirebaseRef} from "angularfire2";
@Injectable()
export class LessonsService {
constructor( @Inject(FirebaseRef) fb) {
const rootDbRef = fb.database().ref();
rootDebRef.on('value', snapshot => console.log(snapshot.val()));
...
}
}
@NgModule({
declarations: [
AppComponent,
...
],
imports: [
BrowserModule,
AngularFireModule.initializeApp(firebaseConfig),
RouterModule.forRoot(routerConfig)
],
providers: [...],
bootstrap: [AppComponent]
})
export class AppModule { }
{
"url": "angular2-hello-world-write-first-application",
"description": "Angular 2 Tutorial For Beginners - Build Your First App - Hello World Step By Step",
"duration": "2:49",
"tags": "BEGINNER",
videoUrl: "https://www.youtube.com/embed/du6sKwEFrhQ",
"longDescription": "This is step by step guide to create your first Angular 2 application. Its aimed at beginners just starting out with the framework.This lesson will show how to create a component, and how to link the component to a given custom HTML tag. It will show how to give the component a given template."
}
{
"url": "angular2-hello-world-write-first-application",
"description": "Angular 2 Tutorial For Beginners - Build Your First App - Hello World Step By Step",
"duration": "2:49",
"tags": "BEGINNER",
videoUrl: "https://www.youtube.com/embed/du6sKwEFrhQ",
"longDescription": "This is step by step guide to create your first Angular 2 application. Its aimed at beginners just starting out with the framework.This lesson will show how to create a component, and how to link the component to a given custom HTML tag. It will show how to give the component a given template."
lessons: [
{
"url": "angular2-hello-world-write-first-application",
"description": "Angular 2 Tutorial For Beginners - Build Your First App - Hello World Step By Step",
"duration": "2:49",
"tags": "BEGINNER",
videoUrl: "https://www.youtube.com/embed/du6sKwEFrhQ",
"longDescription": "This is step by step guide to create your first Angular 2 application. Its aimed at beginners just starting out with the framework.This lesson will show how to create a component, and how to link the component to a given custom HTML tag. It will show how to give the component a given template."
},
{
"url": "angular2-build-your-first-component",
"description": "Building Your First Angular 2 Component - Component Composition",
"duration": "2:07",
"tags": "BEGINNER",
videoUrl: "https://www.youtube.com/embed/VES1eTNxi1s",
"longDescription": "In this lesson we are going to see how to include a component inside another component. We are going to create a simple search box component and include it in our main application."
},
...
]
}
constructor( @Inject(FirebaseRef) fb) {
const rootDbRef = fb.database().ref();
rootDebRef.child('courses').on('value', snap => console.log('Received the whole courses node',snap.val()) );
rootDebRef.child('lessons/-KT_udWS6pEmpLVrxlVw:').on('value',
snap => console.log('Received the whole courses node',snap.val()) );
}
import {initializeApp,database} from 'firebase';
export const firebaseConfig = {
apiKey: "AIzaSyA0BcUcu4V8aHT_gM-32BhRcmqji4z-xts",
authDomain: "some-app.firebaseapp.com",
databaseURL: "https://some-app.firebaseio.com",
storageBucket: "some-app.appspot.com",
messagingSenderId: "290354329699"
};
initializeApp(firebaseConfig);
database().ref().on('value', snapshot => console.log(snapshot.val()));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment