Question: import { Injectable } from '@angular/core'; import { Books } from 'src/assets/data/book.interface'; @Injectable({ providedIn: 'root' }) export class BooksService { ______(Q1)___________________; constructor() { } addToReadingList(book:Books)

import { Injectable } from '@angular/core';

import { Books } from 'src/assets/data/book.interface';

@Injectable({

providedIn: 'root'

})

export class BooksService {

______(Q1)___________________;

constructor() { }

addToReadingList(book:Books) {

this.readingBooks.push(book);

}

getReadingList() {

______(Q2 )___________________;

}

}

  1. Two methods addToReadingList() and getReadingList() are created in the service file books.service.ts. They are used to add a book to the reading list, and to get all books in the reading list respectively. Which of the following codes should be used to fill in the blank at (Q21)?
  1. private books: books[ ];
  2. private readingBooks: Books;
  3. private readingBooks: Books{ };
  4. private readingBooks: Books[ ]=[ ];

2. Which of the following codes should be used to fill in the blank at (Q22)?

  1. return this.readingBooks.push();
  2. return this.readingBooks.splice();
  3. return this.readingBooks.slice();
  4. return this.readingBooks.display();

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!