title: Angular Google Chart - ERROR Error: Invalid row #0 When try to bind data with MongoDB data array
body: <p>I'm building a sankey chart that will get it's data from MongoDB array but when i open it return error.</p>
  
  <pre><code>ERROR Error: Invalid row #0
  at Object.gvjs_ll [as arrayToDataTable]
  at GoogleChartComponent.createDataTable
  at SafeSubscriber._next
  at SafeSubscriber.__tryOrUnsub
  at SafeSubscriber.next 
  at Subscriber._next 
  at Subscriber.next 
  at SwitchMapSubscriber.notifyNext
  at InnerSubscriber._next 
  at InnerSubscriber.next
  </code></pre>
  
  <p>This is the first time i use Google Chart, so i'm not sure why i'm having this error.
  I try to look around a bit but didn't find any fix so i come here to ask.</p>
  
  <p>I use the code for chart from <a href="https://www.tutorialspoint.com/angular_googlecharts/angular_googlecharts_sankey_customized.htm" rel="nofollow noreferrer"><strong>Here</strong></a></p>
  
  <p><strong>firstchart.component.ts</strong></p>
  
  <pre><code>import { Component, OnInit } from '@angular/core';
  import {BackendService} from './../backend.service';
  
  @Component({
    selector: 'firstchart',
    templateUrl: './firstchart.component.html',
    styleUrls: ['./firstchart.component.css']
  })
  export class FirstchartComponent implements OnInit {
  
    public data: object[];
  
    title = '';
    type = 'Sankey';
  
    columnNames = ['From', 'To', 'Weight'];
    options = {       
    };
    width = 1820;
    height = 740;
  
    constructor(private myservice: BackendService) {
    }
  
    ngOnInit() {
      this.myservice.GetList().subscribe(
        (res: any) =&gt; { 
          this.data = res["0"]["list"];
        },
        error =&gt; { 
        }
      );
    }
  
  }
  </code></pre>
  
  <p><strong>server.js</strong></p>
  
  <pre><code>const express = require('express');
  const bodyParser = require('body-parser');
  const mongoose = require('mongoose');
  const app = express();
  const SLDBModel = require('./sldb_schema');         
  require('./db');
  
  app.use(bodyParser.urlencoded({ extended: true }));
  app.use(express.urlencoded({ extended: true }))
  
  app.use(function (req, res, next)
  {
      res.setHeader('Access-Control-Allow-Origin','*');
      res.setHeader('Access-Control-Allow-Methods','GET, POST, PUT, DELETE');
      res.setHeader('Access-Control-Allow-Headers','content-type, x-access-token');
      res.setHeader('Access-Control-Allow-Credentials', true);
      next();
  });
  
  app.get('/api/getList', function (req, res)
  {   
      SLDBModel.find({},function(err, data)
      {
          if(err)
          {
              res.send(err);
          }
          else
          {   
              res.send(data.map(v =&gt; v.toJSON()));
          }
      });
  });
  
  module.exports = app;
  
  app.listen(3000, ()=&gt;
  {
      console.log("SERVER IS ONLINE! ON PORT 3000");
  })
  </code></pre>
  
  <p><strong>data in MongoDB</strong></p>
  
  <pre><code>{
      "_id" : ObjectId("5ec4672e44f01dcae82c3dde"),
      "num_rows" : 3,
      "list" : [ 
          {
              "From" : "All Population",
              "To" : "SBOBETH",
              "Weight" : 1,
              "S_NAME" : "SBOBETH",
              "S_ADD" : "sbobeth.com",
              "S_STATUS" : "UP",
              "S_DPV" : 565
          }, 
          {
              "From" : "All Population",
              "To" : "GTRCASINO",
              "Weight" : 1,
              "S_NAME" : "GTRCASINO",
              "S_ADD" : "gtrcasino.com",
              "S_STATUS" : "DOWN",
              "S_DPV" : 1680
          }, 
          {
              "From" : "All Population",
              "To" : "GTRBETCLUB",
              "Weight" : 1,
              "S_NAME" : "GTRBETCLUB",
              "S_ADD" : "gtrbetclub.com",
              "S_STATUS" : "UP",
              "S_DPV" : 4950
          }, 
          {
              "From" : "All Population",
              "To" : "77UP",
              "Weight" : 1,
              "S_NAME" : "77UP",
              "S_ADD" : "77up.bet",
              "S_STATUS" : "UP",
              "S_DPV" : 273
          }
      ]
  }
  </code></pre>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>&lt;br&gt;
  &lt;div style="text-align: center;"&gt;
     &lt;google-chart #chart
        [title]="title"
        [type]="type"
        [data]="data"
        [columnNames]="columnNames"
        [options]="options"
        [width]="width"
        [height]="height"&gt;
     &lt;/google-chart&gt;
  &lt;/div&gt;
  &lt;br&gt;
  </code></pre>