forked from ReactiveX/rxjs-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(companies): Implement showcase of companies from list in the repo
- Showcase list of companies using RxJS - Remove firebase implementation temporarily to move forward - Added a temporary list of companies to test Close ReactiveX#10
- Loading branch information
1 parent
4255fea
commit 560b20b
Showing
10 changed files
with
51 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { Company } from './companies.model'; | ||
|
||
export const COMPANIES_LIST: Company[] = [ | ||
{ | ||
name: 'Google', | ||
location: 'California', | ||
logo: | ||
'https://upload.wikimedia.org/wikipedia/commons/thumb/2/2d/Google-favicon-2015.png/150px-Google-favicon-2015.png', | ||
website: 'http://google.com' | ||
}, | ||
{ | ||
name: 'Microsoft', | ||
location: 'Seattle', | ||
logo: | ||
'http://diylogodesigns.com/blog/wp-content/uploads/2016/04/Microsoft-Logo-icon-png-Transparent-Background.png', | ||
website: 'http://microsoft.com' | ||
} | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export interface Company { | ||
name: string; | ||
location: string; | ||
website: string; | ||
logo: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,14 @@ | ||
import { CommonModule } from '@angular/common'; | ||
import { MaterialModule } from './../material/material.module'; | ||
import { NgModule } from '@angular/core'; | ||
import { AngularFireModule } from 'angularfire2'; | ||
import { AngularFirestoreModule } from 'angularfire2/firestore'; | ||
|
||
import { CompaniesComponent } from './companies.component'; | ||
import { CompaniesRoutingModule } from './companies-routing.module'; | ||
import { environment } from '../../environments/environment'; | ||
import { CompanyDialogComponent } from '../company-dialog/company-dialog.component'; | ||
import { MatDialogRef } from '@angular/material'; | ||
import { CompanyService } from './company.service'; | ||
import { AngularFireDatabase } from 'angularfire2/database'; | ||
@NgModule({ | ||
imports: [ | ||
CommonModule, | ||
CompaniesRoutingModule, | ||
MaterialModule, | ||
AngularFirestoreModule, | ||
AngularFireModule.initializeApp(environment.firebase) | ||
], | ||
declarations: [CompaniesComponent, CompanyDialogComponent], | ||
entryComponents: [CompanyDialogComponent], | ||
providers: [CompanyService, AngularFireDatabase] | ||
imports: [CommonModule, CompaniesRoutingModule, MaterialModule], | ||
declarations: [CompaniesComponent], | ||
providers: [CompanyService] | ||
}) | ||
export class CompaniesModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,12 @@ | ||
import { Injectable } from "@angular/core"; | ||
import { AngularFireDatabase, AngularFireList } from "angularfire2/database"; | ||
import * as firebase from "firebase"; | ||
import { Observable } from "rxjs/Observable"; | ||
import { Injectable } from '@angular/core'; | ||
import { Observable } from 'rxjs/observable'; | ||
import { of } from 'rxjs/observable/of'; | ||
import { COMPANIES_LIST } from './companies-list'; | ||
import { Company } from './companies.model'; | ||
|
||
@Injectable() | ||
export class CompanyService { | ||
constructor(private db: AngularFireDatabase) {} | ||
basePath = "uploads"; | ||
uploadsRef: AngularFireList<any>; | ||
uploads: Observable<any[]>; | ||
// Executes the file uploading to firebase https://firebase.google.com/docs/storage/web/upload-files | ||
|
||
pushUpload(upload: any) { | ||
const storageRef = firebase.storage().ref(); | ||
const uploadTask = storageRef | ||
.child(`${this.basePath}/${upload.name}`) | ||
.put(upload); | ||
return uploadTask; | ||
getCompanies(): Observable<Company[]> { | ||
return of(COMPANIES_LIST); | ||
} | ||
} |
Empty file.