View wc-loader.js
var container = document.getElementById("container");
function loadApp(app) {
container.innerHTML = '';
var element = document.createElement(app);
element.onload = function (load) {
console.log('loaded', load);
};
View wc-index.html
<!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>
View json-to-firestore.js
const admin = require('./node_modules/firebase-admin');
const serviceAccount = require("./service-key.json");
const data = require("./data.json");
admin.initializeApp({
credential: admin.credential.cert(serviceAccount),
databaseURL: "https://YOUR_DB.firebaseio.com"
});
View ng-firebase.gitlab-ci.yml
.node: &node
image: node:7
before_script:
- npm install
cache:
key: "$CI_COMMIT_REF_NAME"
paths:
- node_modules/
stages:
View ng-firebase.npm-scripts.json
"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"
}
View .firebaserc
{
"projects": {
"default": "ng-firebase-dev",
"develop": "ng-firebase-dev",
"production": "ng-firebase-241bb"
}
}
View firebase.json
{
"database": {
"rules": {
".read": "true",
".write": "true"
}
},
"hosting": {
"public": "dist",
"rewrites": [{
View ng-firebase.app.component.html
<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>
View ng-firebase.app.component.ts
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 {
View ng-firebase.environment.ts
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"
}