import { Component, OnInit, Input, ViewChild, ElementRef } from '@angular/core'; import axios from 'axios'; @Component({ selector: 'github-informations', templateUrl: './github-informations.component.html', styleUrls: ['./github-informations.component.css'] }) export class GithubInformationsComponent implements OnInit { @Input() ngStyle: { [key: string]: string; } @Input() username: string; @ViewChild('httprequest') el: ElementRef; constructor() { } ngOnInit() { axios .get("https://api.github.com/users/" + this.username) .then(res => { const tableInfo = document.getElementById("main--table"); const tableStatus = document.getElementById("status--table"); var infos = ""; var status = ""; const dataObject = JSON.stringify(res.data, null); const dataJSON = JSON.parse(dataObject); infos += "OptionsInformation"; for (var x in dataJSON) { infos += "" + x + "" + dataJSON[x] + ""; } tableInfo.innerHTML = infos; status += "
OptionsInformation
Status" + res.status + "
"; tableStatus.innerHTML = status; }) .catch(error => { console.log(error); }); } ngAfterViewInit() { } }