Advertisement
Guest User

Untitled

a guest
Jan 20th, 2017
329
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. <!--template bindings={
  2. "ng-reflect-ng-for-of": "[object Object],[object Object]"
  3. }-->
  4.  
  5. import { Component, OnInit } from '@angular/core';
  6.  
  7. import { AngularFire, FirebaseListObservable } from 'angularfire2';
  8.  
  9. import { FirebaseService } from './services/database.service';
  10.  
  11.  
  12.  
  13. export interface answers {
  14. $key: string;
  15. id: string;
  16. answer: string;
  17. }
  18.  
  19. export interface questions {
  20. $key: string;
  21. question: string;
  22. id: string;
  23. name: string;
  24. answers: answers[];
  25. }
  26.  
  27. export interface bus_image {
  28. $key: string;
  29. questions: questions[];
  30. }
  31.  
  32. @Component({
  33. moduleId: module.id,
  34. selector: 'app-root',
  35. templateUrl: './app.component.html',
  36. styleUrls: [ './app.component.css' ],
  37. providers: [ FirebaseService ]
  38. })
  39.  
  40.  
  41.  
  42. export class AppComponent implements OnInit {
  43.  
  44. title = 'app works!';
  45. businessImage: bus_image;
  46.  
  47. constructor(private _firebaseService:FirebaseService){}
  48.  
  49. ngOnInit() {
  50. this._firebaseService.getBusImg().subscribe(businessImage => {
  51. this.businessImage = businessImage;
  52. console.log(businessImage);
  53. });
  54. }
  55. }
  56.  
  57. <h1>{{title}}</h1>
  58.  
  59. <div *ngFor="let questions of businessImage">
  60. <h1>{{questions.question}}</h1>
  61. <ul>
  62. <li *ngFor="let answer of answers">
  63. {{answers.answer}}
  64. </li>
  65. </ul>
  66. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement