File

src/app/app-poll/app-poll.data.ts

Implements

InMemoryDbService

Index

Methods

Methods

createDb
createDb()
Returns : { polls: {}; }
import { InMemoryDbService } from 'angular-in-memory-web-api';
import { AppPoll } from './app-poll';

export class AppPollData implements InMemoryDbService{
  
  createDb(){
        const polls: AppPoll[] = 
        [{
                "id": 1,
                "title": "Is bitcoin worth the time and money that mining requires?",
                "publishedDate": 1516605447,
                "answer": {
                  "type": "Single",
                  "options": [{
                      "id": 1,
                      "label": "Yes"
                    },
                    {
                      "id": 2,
                      "label": "No"
                    }
                  ]
                }
              },
              {
                "id": 2,
                "title": "Should chatbots replace humans in customer service jobs?",
                "publishedDate": 1516000647,
                "answer": {
                  "type": "Single",
                  "options": [{
                      "id": 3,
                      "label": "Yes"
                    },
                    {
                      "id": 4,
                      "label": "No"
                    }
                  ]
                }
              },
              {
                "id": 3,
                "title": "How are we feeling about 2018?",
                "publishedDate": 1515568647,
                "answer": {
                  "type": "Single",
                  "options": [{
                      "id": 5,
                      "label": "Hopeful"
                    },
                    {
                      "id": 6,
                      "label": "Doubtful"
                    }
                  ]
                }
              },
              {
                "id": 4,
                "title": "Which country/region have you ever visited? (Select all that applies)",
                "publishedDate": 1515482247,
                "answer": {
                  "type": "Multi",
                  "options": [{
                      "id": 7,
                      "label": "Hong Kong"
                    },
                    {
                      "id": 8,
                      "label": "China"
                    },
                    {
                      "id": 9,
                      "label": "Australia"
                    },
                    {
                      "id": 10,
                      "label": "Thailand"
                    },
                    {
                      "id": 11,
                      "label": "Korea"
                    },
                    {
                      "id": 12,
                      "label": "Japan"
                    }
                  ]
                }
              },
              {
                "id": 5,
                "title": "Will new benefits encourage you to study or work in mainland?",
                "publishedDate": 1515309447,
                "answer": {
                  "type": "Single",
                  "options": [{
                      "id": 13,
                      "label": "Yes"
                    },
                    {
                      "id": 14,
                      "label": "No"
                    }
                  ]
                }
              }
            ];
        
            return { polls };
        }
}

result-matching ""

    No results matching ""