this.myservice.getData is not a function error give in Angular 8

I need to fetch data from a API. I followed this tutorial in tutorials point> I have done the project as guided by this tutorial. But this error is given in console

AppComponent_Host.ngfactory.js? [sm]:1 ERROR TypeError: this.myservice.getData is not a function
    at AppComponent.ngOnInit (app.component.ts:62)
    at checkAndUpdateDirectiveInline (core.js:31909)
    at checkAndUpdateNodeInline (core.js:44366)
    at checkAndUpdateNode (core.js:44305)
    at debugCheckAndUpdateNode (core.js:45327)
    at debugCheckDirectivesFn (core.js:45270)
    at Object.eval [as updateDirectives] (AppComponent_Host.ngfactory.js? [sm]:1)
    at Object.debugUpdateDirectives [as updateDirectives] (core.js:45258)
    at checkAndUpdateView (core.js:44270)
    at callWithDebugContext (core.js:45631)

enter image description here

These are my source code


import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';

import { GoogleChartsModule } from 'angular-google-charts';

import { HttpClientModule } from '@angular/common/http';
import {ApiService} from './api.service';

import {MyserviceServiceService} from './myservice-service.service';

  declarations: [
  imports: [
  providers: [ApiService,MyserviceServiceService],
  bootstrap: [AppComponent]
export class AppModule { }


import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';

  providedIn: 'root'
export class MyserviceServiceService {

  private finaldata = [];
  private apiurl = "";
  constructor(private http: HttpClient) { }
  getData() {
     return this.http.get(this.apiurl);


import {MyserviceServiceService} from './myservice-service.service';

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

  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
export class AppComponent {
  title = 'Angular 7 Project!';
  public persondata = [];
  constructor(private myservice: MyserviceServiceService) {}
  ngOnInit() {
     this.myservice.getData().subscribe((data) => {
        this.persondata = Array.from(Object.keys(data), k=>data[k]);

anyone can give me the solution for the problem?

Source: New feed
Source Url this.myservice.getData is not a function error give in Angular 8