Skip to content

Instantly share code, notes, and snippets.

View kobvel's full-sized avatar

Mikki Kobvel kobvel

View GitHub Profile
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AngularFireModule } from 'angularfire2';
import { AngularFireDatabaseModule } from 'angularfire2/database';
import { AngularFireAuthModule } from 'angularfire2/auth';
import { environment } from 'environments/environment';
import { AppComponent } from './app.component';
export const environment = {
production: false,
firebaseConfig: {
apiKey: "AIzaSyBjsEXmLI-4kOcz793QZh9ElN_iSHlO74M",
authDomain: "ng-firebase-dev.firebaseapp.com",
databaseURL: "https://ng-firebase-dev.firebaseio.com",
projectId: "ng-firebase-dev",
storageBucket: "ng-firebase-dev.appspot.com",
messagingSenderId: "644800494252"
}
import { Component } from '@angular/core';
import { AngularFireDatabase, AngularFireList } from 'angularfire2/database';
import { Observable } from 'rxjs/Observable';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
<ul>
<li *ngFor="let item of items | async">
<input type="text" #updatetext [value]="item.text" />
<button (click)="updateItem(item.key, updatetext.value)">Update</button>
<button (click)="deleteItem(item.key)">Delete</button>
</li>
</ul>
<input type="text" #newitem />
<button (click)="addItem(newitem.value)">Add</button>
<button (click)="deleteEverything()">Delete All</button>
{
"database": {
"rules": {
".read": "true",
".write": "true"
}
},
"hosting": {
"public": "dist",
"rewrites": [{
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"predeploy": "firebase use --token $FIREBASE_DEPLOY_KEY $CI_ENVIRONMENT_SLUG",
"deploy": "firebase deploy --non-interactive --token $FIREBASE_DEPLOY_KEY"
}
.node: &node
image: node:7
before_script:
- npm install
cache:
key: "$CI_COMMIT_REF_NAME"
paths:
- node_modules/
stages:
{
"projects": {
"default": "ng-firebase-dev",
"develop": "ng-firebase-dev",
"production": "ng-firebase-241bb"
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Web components loader</title>
<link rel="import" href="./apps/angular-app.html">
<link rel="import" href="./apps/react-app.html">
</head>
<body>
<h1>Hello web-components</h1>
initProfileData(): void {
this.store.take(1).subscribe(store => {
if (!store.profile.profileData) {
this.apiService.getProfileData().toPromise()
.then(data => {
this.store.dispatch(new profileActions.UpdateAction(data));
})
.catch(err => {
this.router.navigate(['/404'])
});