Angular12 get API making table data not showing - html

So I'm trying to make a table that use ngFor for every data in the API. I tried a tutorial in Youtube video and it is working fine. Now I'm trying it with the API given to me, but the problem is the data is not coming out in the table
<!-- Main content -->
<section class="content">
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<!-- TABLE: LATEST ORDERS -->
<div class="card">
<div class="card-header border-transparent">
<h3 class="card-title">Latest Orders</h3>
<div class="card-tools">
<button type="button" class="btn btn-tool" data-card-widget="collapse">
<i class="fas fa-minus"></i>
</button>
<button type="button" class="btn btn-tool" data-card-widget="remove">
<i class="fas fa-times"></i>
</button>
</div>
</div>
<!-- /.card-header -->
<div class="card-body p-0">
<div class="table-responsive">
<table class="table m-0">
<thead>
<tr>
<th>Order ID</th>
<th>Item</th>
<th>Status</th>
<th>Popularity</th>
</tr>
</thead>
<tbody>
<tr>
<td>OR9842</td>
<td>Call of Duty IV</td>
<td><span class="badge badge-success">Shipped</span></td>
<td>
<div class="sparkbar" data-color="#00a65a" data-height="20">90,80,90,-70,61,-83,63</div>
</td>
</tr>
<tr *ngFor="let campaign of campaigns | async">
<td>{{campaign.id}}</td>
<td>{{campaign.name}}</td>
<td><span class="badge badge-warning">Pending</span></td>
<td>
<div class="sparkbar" data-color="#f39c12" data-height="20">90,80,-90,70,61,-83,68</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- /.table-responsive -->
</div>
<!-- /.card-body -->
<div class="card-footer clearfix">
</div>
<!-- /.card-footer -->
</div>
<!-- /.card -->
</div>
<!-- /.col -->
</div> <!-- /.row -->
campaign.component.ts
import { Component, OnInit } from '#angular/core';
import { GetServiceService } from '../get-service.service';
#Component({
selector: 'app-campaign',
templateUrl: './campaign.component.html',
styleUrls: ['./campaign.component.css']
})
export class CampaignComponent implements OnInit {
campaigns;
constructor(
private campaignService: GetServiceService,
) { }
ngOnInit(): void {
this.campaigns = this.campaignService.getCampaign();
}
}
get-service.service.ts
import { Injectable } from '#angular/core';
import { HttpClient } from '#angular/common/http';
#Injectable({
providedIn: 'root'
})
export class GetServiceService {
constructor(
private http: HttpClient
) { }
getCampaign(){
return this.http.get('https://emaillead.aturtoko.id/api/v1/campaign')
}
}
So my expectation is that this code would give out the list of data in my API (ignore the first ). What actually happen is that the table only show the first , which means the data is not showing up on the table.
The error in the console is
ERROR Error: Cannot find a differ supporting object '[object Object]' of type 'object'. NgFor only supports binding to Iterables such as Arrays.
at NgForOf.ngDoCheck (common.js:3184)
at callHook (core.js:2536)
at callHooks (core.js:2495)
at executeCheckHooks (core.js:2427)
at refreshView (core.js:9474)
at refreshComponent (core.js:10636)
at refreshChildComponents (core.js:9261)
at refreshView (core.js:9515)
at refreshEmbeddedViews (core.js:10590)
at refreshView (core.js:9489)
The data in api from postman get is
{
"success": true,
"message": "success",
"data": [
{
"id": 1,
"name": "buattoko"
},
{
"id": 2,
"name": "omnipos"
},
{
"id": 3,
"name": "pluscampaign"
}
]
}
what do I need to do to get the data to the table?

Add pipe and map rxjs operator to transform the result as response.data.
get-service.service.ts
import { map } from 'rxjs/operators';
getCampaign() {
return this.http.get('https://emaillead.aturtoko.id/api/v1/campaign')
.pipe(map((response: any) => response.data));
}
Sample Solution on StackBlitz

Related

how to refresh result count when deleting a row in table using angular

I have one small label where i am showing total result count of one table data.below i am using one table,On that i'm showing list of data.when i'm deleting one row in table,table is refreshing but in that label result count is not refreshing.Here is my data..
import { VsnApplicationsServiceProxy, VsnApplicationDto , CreateOrEditVsnApplicationDto } from '#shared/service-proxies/service-proxies';
#Component({
selector: 'vsn-applicationmappings',
templateUrl: './applicationmappings.component.html',
styleUrls: ['./applicationmappings.component.less'],
encapsulation: ViewEncapsulation.None,
animations: [appModuleAnimation()]
})
export class ApplicationMappingsComponent extends AppComponentBase implements OnInit {
applications: any;
constructor(
injector: Injector,
private _vsnApplicationsServiceProxy: VsnApplicationsServiceProxy,
private _activatedRoute: ActivatedRoute,
) {
super(injector);
}
ngOnInit() {
this._vsnApplicationsServiceProxy.getAll("", "", "", "", "", "", "", 0, 100).subscribe((Applications: any) => {
this.applications = Applications.totalCount;
console.log(' application value', Applications.totalCount);
});
}
getVsnApplications(event?: LazyLoadEvent) {
if (this.primengTableHelper.shouldResetPaging(event)) {
this.paginator.changePage(0);
return;
}
this.primengTableHelper.showLoadingIndicator();
this._vsnApplicationsServiceProxy.getAll(
this.filterText,
this.nameFilter,
this.businessNameFilter,
this.vsnApplicationTypeNameFilter,
this.vsnApplicationCategoryNameFilter,
this.vsnApplicationSubCategoryNameFilter,
this.primengTableHelper.getSorting(this.dataTable),
this.primengTableHelper.getSkipCount(this.paginator, event),
this.primengTableHelper.getMaxResultCount(this.paginator, event)
).subscribe(result => {
this.primengTableHelper.totalRecordsCount = result.totalCount;
this.primengTableHelper.records = result.items;
this.primengTableHelper.hideLoadingIndicator();
});
}
reloadPage(): void {
this.paginator.changePage(this.paginator.getPage());
}
createVsnApplication(): void {
this.createOrEditVsnApplicationModal.show();
}
deleteVsnApplication(vsnApplication: VsnApplicationDto): void {
this.message.confirm(
'',
(isConfirmed) => {
if (isConfirmed) {
this._vsnApplicationsServiceProxy.delete(vsnApplication.id)
.subscribe(() => {
this.reloadPage();
this.notify.success(this.l('SuccessfullyDeleted'));
});
}
}
);
}
<div class="col-sm-2">
<div class="box">
<div><br><br>
<h4>{{applications}}</h4>
</div>
<div> <span>
<h6>Applications</h6>
</span></div>
</div>
</div>
<div class="m-content">
<div class="m-portlet m-portlet--mobile">
<div class="m-portlet__body">
<div class="primeng-datatable-container" [busyIf]="primengTableHelper.isLoading">
<p-table #dataTable (onLazyLoad)="getVsnApplications($event)" [value]="primengTableHelper.records"
rows="{{primengTableHelper.defaultRecordsCountPerPage}}" [paginator]="false" [lazy]="true"
[scrollable]="true" ScrollWidth="100%" [responsive]="primengTableHelper.isResponsive"
[resizableColumns]="primengTableHelper.resizableColumns">
<ng-template pTemplate="header">
<tr>
<th style="width: 150px" pSortableColumn="vsnApplicationType.name">
{{l("ApplicationName")}}
<p-sortIcon field="vsnApplication.name"></p-sortIcon>
</th>
<th style="width: 130px"
[hidden]="!isGrantedAny('Pages.Administration.VsnApplicationTypes.Edit', 'Pages.Administration.VsnApplicationTypes.Delete')">
{{l('Actions')}}</th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-record="$implicit">
<tr>
<td style="width:150px">
<span class="ui-column-title"> {{l("ApplicationName")}}</span>
{{record.vsnApplication.businessName}}
</td>
<td style="width: 130px"
[hidden]="!isGrantedAny('Pages.Administration.VsnApplications.Edit', 'Pages.Administration.VsnApplications.Delete')">
<div class="btn-group dropdown" dropdown container="body">
<button class="dropdown-toggle btn btn-sm btn-primary" dropdownToggle>
<i class="fa fa-cog"></i><span class="caret"></span> {{l("Actions")}}
</button>
<ul class="dropdown-menu" *dropdownMenu>
<li>
<a href="javascript:;"
(click)="viewVsnApplicationModal.show(record)">{{l('View')}}</a>
</li>
<li>
<a href="javascript:;"
*ngIf="permission.isGranted('Pages.Administration.VsnApplicationTypes.Edit')"
(click)="createOrEditVsnApplicationModal.show(record.vsnApplication.id)">{{l('Edit')}}</a>
</li>
<li>
<a href="javascript:;"
*ngIf="permission.isGranted('Pages.Administration.VsnApplicationTypes.Delete')"
(click)="deleteVsnApplication(record.vsnApplication)">{{l('Delete')}}</a>
</li>
</ul>
</div>
</td>
</tr>
</ng-template>
</p-table>
<div class="primeng-no-data" *ngIf="primengTableHelper.totalRecordsCount == 0">
{{l('NoData')}}
</div>
<div class="primeng-paging-container">
<p-paginator rows="{{primengTableHelper.defaultRecordsCountPerPage}}" #paginator
(onPageChange)="getVsnApplications($event)"
[totalRecords]="primengTableHelper.totalRecordsCount"
[rowsPerPageOptions]="primengTableHelper.predefinedRecordsCountPerPage">
</p-paginator>
<span class="total-records-count">
{{l('TotalRecordsCount', primengTableHelper.totalRecordsCount)}}
</span>
</div>
</div>
</div>
</div>
<createOrEditVsnApplicationModal #createOrEditVsnApplicationModal (modalSave)="getVsnApplications()">
</createOrEditVsnApplicationModal>
<viewVsnApplicationModal #viewVsnApplicationModal></viewVsnApplicationModal>
</div>
When deleting one row, the table is refreshing and showing updated records.but in that result count lable is not refreshing.I searched in stack overflow,I found that we have to give like splice(id,1)
but it is not working,any suggestions would great help..

Why angular-datatable not fill col in bootstrap 4?

I tried to set a responsive table with angular-datatables (for angular 7) and bootstrap 4 but this is the current aspect of the table:
Current HTML code:
<div class="row">
<div class="col-12">
<div class="table-responsive">
<table datatable [dtOptions]="dtOptions" [dtTrigger]="dtTrigger" class="table table-hover table-bordered">
<thead class="thead-colored thead-primary">
<tr class="text-center">
<th>ID</th>
<th>NICKNAME</th>
<th>EMAIL</th>
<th>REGISTRO</th>
<th>ESTATUS</th>
<th>ALTA</th>
<th>ACCIONES</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let usuario of usersArray" class="text-center">
<td>{{usuario.ID}}</td>
<td>{{usuario.NICKNAME}}</td>
<td>{{usuario.EMAIL}}</td>
<td>{{usuario.REGISTRO | date: 'dd-MMMM-yyyy' | uppercase}}</td>
<td>
<span class="bg-success pd-y-3 pd-x-10 text-white tx-11 tx-roboto">
{{usuario.ESTATUS | toStatusReadable}}
</span>
</td>
<td>{{usuario.PROVEEDORACCESO}}</td>
<td>
<div type="button" class="dropdown">
<a [routerLink]="" class="tx-gray-800 d-inline-block" data-toggle="dropdown">
<div class="ht-45 pd-x-20 bd d-flex align-items-center justify-content-center">
<span class="mg-r-10 tx-13 tx-medium">Opciones</span>
<img src="https://via.placeholder.com/500" class="wd-25 rounded-circle" alt="">
<i class="fas fa-angle-down"></i>
</div>
</a>
<div class="dropdown-menu pd-10 wd-200">
<nav class="nav nav-style-2 flex-column">
<a [routerLink]="" class="nav-link"><i class="icon fas fa-edit"></i> Editar datos</a>
</nav>
</div>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
TS File code for the table:
export class AdministradoresComponent implements OnInit, OnDestroy {
/* dtOptions: DataTables.Settings = {}; */
dtOptions: any = {};
dtTrigger: Subject<any> = new Subject<any>();
usersArray: Array<Users> = [];
constructor(
private devInfo: DevelopmentService,
private dtService: DatatableService,
private administradoresService: AdministradoresService
) {
this.ObtenerUsuariosSmartlive();
}
ngOnInit() {
document.getElementById('mainSystemPanel').removeAttribute('class');
document.getElementById('mainSystemPanel').className = 'br-mainpanel';
this.dtOptions = this.dtService.getDataTableConfig();
}
ngOnDestroy() {
this.dtTrigger.unsubscribe();
}
async ObtenerUsuariosSmartlive() {
const usuarios = <any []> await this.administradoresService.getSmartliveUsersList();
for ( let i = 0; i < usuarios.length; i++) {
this.usersArray.push(JSON.parse(usuarios[i]));
}
this.dtTrigger.next();
}
}
The service to provide config of the table:
export class DatatableService {
constructor() {
}
getDataTableConfig() {
return {
language: {
url: 'assets/content/smartlive/spanish.json'
},
responsive: true
};
}
}
angular.json snippet:
"styles": [
"node_modules/#fortawesome/fontawesome-free/css/all.min.css",
"node_modules/animate.css/animate.min.css",
"src/assets/content/template/lib/ionicons/css/ionicons.min.css",
"src/assets/content/template/lib/rickshaw/rickshaw.min.css",
"src/assets/content/template/lib/select2/css/select2.min.css",
"src/assets/content/template/css/bracket.css",
"src/assets/content/template/css/bracket.oreo.css",
"node_modules/datatables.net-dt/css/jquery.dataTables.min.css",
"node_modules/datatables.net-bs/css/dataTables.bootstrap.min.css",
"node_modules/datatables.net-responsive-dt/css/responsive.dataTables.min.css",
"src/styles.css"
],
"scripts": [
"node_modules/jquery/dist/jquery.js",
"node_modules/datatables.net/js/jquery.dataTables.js",
"node_modules/datatables.net-bs/js/dataTables.bootstrap.min.js",
"node_modules/datatables.net-responsive/js/dataTables.responsive.min.js"
]
I already installed all the packages files for the datatable but i can't set a correct 100% of width and always the pagination and search input have a bad location over the table.
A bit late but it might help someone else ;-)
Try:
npm install datatables.net-bs4
Then call:
"styles": [
...
"./node_modules/datatables.net-bs4/css/dataTables.bootstrap4.min.css",
...
],
"scripts": [
...
"./node_modules/datatables.net-bs4/js/dataTables.bootstrap4.min.js",
...
],

How to select particular field in Angular 6

enter image description here
html code
<div id="myModal" class="modal">
<div class="modal-content">
<div class="modal-header" style="text-align: center;">
<span class="close">×</span>
<h2>Register Account</h2>
</div>
<div class="modal-body">
<div class="signup-body">
<div class="su-body" style="background-color:#3B5998;">
Employer
</div>
<div class="su-body" style="background-color:#3B5998;">
Candidate
</div>
</div>
<div class="signup-body">
<div class="su-body" style="background-color:#3B5998;">
Login with Faceboo
</div>
<div class="su-body" style="background-color:#3B5998;">
Login With Google
</div>
</div>
<div class="signup-body">
<div class="su-body" style="background-color:#3B5998;">
Login With Linkedin
</div>
<div class="su-body" style="background-color:#3B5998;">
Login With Twitter
</div>
</div>
</div>
<div class="modal-footer">
<div class="signup-body">
<!-- <button>Sign up</button> -->
<div class="su-body" style="background-color:#3B5998;">
Sign up
</div>
</div>
<p>Already have ab account</p>Login
</div>
</div>
</div>
I want to create a registration page has given below in angular 6. But my question is when user can register two ways (either employer or candidate ) so how can i send Api particular field data. please help me.
Please check below solution might be it can help you to observe Registration Type:
Registered Event in Html:
<div class="signup-body">
<div class="su-body" style="background-color:#3B5998;">
<a href="#" target="_blank" (onclick)="changeReg('Employer')" >Employer</a>
</div>
<div class="su-body" style="background-color:#3B5998;">
<a href="#" target="_blank" (onclick)="changeReg('Candidate')" >Candidate</a>
</div>
</div>
Create a data sharing service
import { Injectable } from '#angular/core';
import { BehaviorSubject } from 'rxjs';
#Injectable()
export class DataService {
private regSource = new BehaviorSubject('Employer'); //Default registration type
currentReg = this.regSource.asObservable();
constructor() { }
changeRegType(regTyp: string) {
this.regSource.next(regTyp)
}
}
Set New Registration type within Supplied Html component:
import { Component, OnInit } from '#angular/core';
import { DataService } from "../data.service";
#Component({
selector: 'app-registration',
styleUrls: ['./registration-selection.component.css']
})
export class RegistrationSelectionComponent implements OnInit {
constructor(private data: DataService) { }
changeReg(regType:String) {
this.data.changeRegType(regType);
}
}
Get default/new registration type in signup component:
import { Component, OnInit } from '#angular/core';
import { DataService } from "../data.service";
#Component({
selector: 'app-signup',
template: `
{{message}}
`,
styleUrls: ['./signup.component.css']
})
export class SignUpCmponent implements OnInit {
regType:string;
constructor(private data: DataService) { }
ngOnInit() {
this.data.currentReg.subscribe(reg => this.regType = reg)
}
}

Problem in updating the HTML table data as the browser crashes when I am getting the data every second using Socket

I am showing real time data in a HTML table by getting the data from back-end socket developed using Node.js, which sends the data of 200 row (objects) every second which haves some object's value changed.
When I am trying to display or render those data in HTML table, the browser crashes and displays nothing.
I am using Angular and D3 table libraries to do. The code is attached below. Please help me with some ways to fix this or even some better idea to resolved this issue.
My Component.ts File
import { Component, OnInit } from '#angular/core';
import { HttpService } from '../../Service/http.service';
import { SymbolClass } from 'src/app/Model/Symbol';
import { SocketService } from 'src/app/Service/socket.service';
import { ResponseClass } from 'src/app/Model/Response';
import * as d3 from 'd3';
import { Subscription } from 'rxjs';
import { DataSetClass } from 'src/app/Model/DataSet';
import { ChangeDetectorRef } from '#angular/core';
import { BidData } from 'src/app/Model/DataBid';
#Component({
selector: 'dashboard',
templateUrl: './dashboard.component.html',
styleUrls: ['./dashboard.component.css']
})
export class DashboardComponent implements OnInit {
private symbolList: SymbolClass[];
private symbolSelected = "XBTUSD";
private url = 'http://188.166.85.186:7000';
private socket;
private dataSetlist: ResponseClass;
private sub: Subscription;
private askDept: DataSetClass[];
private bidDept: BidData[];
constructor(private httpService: HttpService, private socketService: SocketService, private changeDetectorRef: ChangeDetectorRef) {
}
ngOnInit() {
var leftTable = d3.select('#leftTable')
var rightTable = d3.select('#rightTable')
leftTable.append('tbody')
rightTable.append('tbody')
this.httpService.getSymbol()
.subscribe(data => {
this.symbolList = data
this.socketService.emitAfterSymbolChange(this.symbolSelected);
this.sub = this.socketService.getDataResponse()
.subscribe(data => {
this.dataSetlist = data
this.askDept = data.askDepth
this.setupData(this.askDept,'#leftTable')
this.bidDept = data.bidDepth
this.setupData(this.bidDept,'#rightTable')
});
});
}
private dev = function(){
this.setupData(this.randomizeData(),'#leftTable')
this.setupData(this.randomizeData(),'#rightTable')
}
private setupData = function (data: any,tableType: String) {
var rows = d3.select(tableType).select('tbody')
.selectAll('tr')
.data(data, function (d) {
return d.title;
})
rows.exit().remove()
var entertd = rows.enter()
.append('tr')
.selectAll('td')
.data(function (d) {
return d3.map(d).values();
})
.enter()
.append('td')
.append('div')
.append('span')
.text(function(d){
return d;
})
var td = rows.selectAll('td')
.data(function (d) {
return d3.map(d).entries();
})
.attr('class', function (d) { return d.key })
td.select('span')
.text(function (d) {
if (d.key == 'conversion_rate') {
return Math.round(100 * d.value) + '%'
}
return d.value
})
}
}
My component.html file
<div class="container" style="margin-top: 100px; margin-bottom: 100px;">
<select class="form-control">
<option *ngFor="let sym of symbolList">{{sym}}</option>
</select>
<div class="row" style="margin:20px 0px;">
<button (click)="dev()" type="button">Update Data</button>
</div>
<div class="row">
<div class="col-lg-12 col-md-12 mt-2">
<div class="chartDoug bg-dark">
<span class="headTip text-nowrap" style="font-size:20px">Live Order Book!</span>
<div id="myChart"></div>
</div>
</div>
</div>
<div class="row">
<div class="col col-xs-12 col-sm-6 col-md-3 col-lg-3">
<h4 style="text-align:center; color:red;float:left;margin-left:10px;">Volumn:</h4>
<h4 style="text-align:right; color:red;float:left;margin-left:5px;" class="volumn"></h4>
</div>
<div class="col col-xs-12 col-sm-6 col-md-3 col-lg-3">
<h4 style="text-align:center; color:green;float:left;margin-left:10px;">Last Price:</h4>
<h4 style="text-align:right; color:green;float:left;margin-left:5px;" class="lastprice"></h4>
</div>
<div class="col col-xs-12 col-sm-6 col-md-3 col-lg-3">
<h4 style="text-align:center; color:red;float:left;margin-left:10px;">HIGH:</h4>
<h4 style="text-align:right; color:red;margin-left:5px;float:left;" class="high"></h4>
</div>
<div class="col col-xs-12 col-sm-6 col-md-3 col-lg-3">
<h4 style="text-align:center; color:green;float:left;margin-left:10px;">LOW:</h4>
<h4 style="text-align:right; color:green;margin-left:5px;float:left;" class="low"></h4>
</div>
</div>
<div class="row">
<div class="col col-xs-12 col-sm-12 col-md-6 col-lg-6">
<h2 style="text-align:center; color:green;">BUY</h2>
<h4 style="text-align:right; color:green;" class="buy_total_amount"></h4>
<table id="leftTable" class="table table-striped table-bordered table-hover">
<thead>
<tr>
<th style="text-align: center;">No</th>
<th style="text-align: center;">Price</th>
<th style="text-align: center;">Quantity</th>
<th style="text-align: center;">Total Amount</th>
</tr>
</thead>
<tbody style="text-align: right;" class="buy">
</tbody>
</table>
</div>
<div class="col col-xs-12 col-sm-12 col-md-6 col-lg-6">
<h2 style="text-align:center; color:red;">SELL</h2>
<h4 style="text-align:right; color:red;" class="sell_total_amount"></h4>
<table id="rightTable" class="table table-striped table-bordered table-hover">
<thead>
<tr>
<th style="text-align: center;">No</th>
<th style="text-align: center;">Price</th>
<th style="text-align: center;">Quantity</th>
<th style="text-align: center;">Total Amount</th>
</tr>
</thead>
<tbody style="text-align: right;" class="sell">
</tbody>
</table>
</div>
</div>
</div>

Struggling to read in JSON file in Angular 2+ project

I have used the Angular CLI to set up this project so the standard folder layout holds. I am trying to practice reading in a JSON file from src/app/assets/items.json and use it to display these items in the html.
items.json:
{
"results": [
"Item 1",
"Item 2",
]
}
app.service.ts in src/app/:
import { Injectable } from '#angular/core';
import { Http, Response, Headers, RequestOptions } from '#angular/http';
import { Observable } from 'rxjs/Rx';
// Import RxJs required methods
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/catch';
#Injectable()
export class AppService {
private greetUrl = 'api/Hello';
// Resolve HTTP using the constructor
constructor(private _http: Http) { }
findJSON(): Observable<any> {
return this._http.get('assets/items.json').map((response: Response) => {
return response.json();
});
}
sayHello(): Observable<any> {
return this._http.get(this.greetUrl).map((response: Response) => {
return response.text();
});
}
}
and app.component.ts in src/app:
import { Component, OnInit } from '#angular/core';
import { Http, Response } from '#angular/http';
import { AppService } from './app.service';
#Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit {
greetings = '';
itemsjson : string;
constructor(private _appService: AppService) { }
ngOnInit(): void {
this._appService.findJSON()
.subscribe(
result => {
this.itemsjson = result;
}
);
}
}
and app.component.html in src/app/:
<html lang="en">
<link rel="stylesheet" href="https://bootswatch.com/cerulean/bootstrap.min.css">
<head>
<meta charset="utf-8">
<title>Yik-Yak Clone</title>
</head>
<body>
<div class="navbar navbar-default navbar-fixed-top">
<div class="container">
<div class="navbar-header">
Yik-Yak Clone
</div>
</div>
</div>
<!-- Containers
================================================== -->
<div class = "container">
<div class="row">
<div class="col-lg-12">
<div class="bs-component">
<div class="jumbotron">
<h1>{{itemsjson}}</h1>
</div>
</div>
</div>
</div>
</div>
<!-- Containers
================================================== -->
<div class = "container">
<div class="row">
<div class="col-lg-12">
<div class="bs-component">
<div class="jumbotron">
<h1>{{itemsjson}}</h1>
</div>
</div>
</div>
</div>
</div>
<!--
================================================== -->
<div class = "container">
<div class="row">
<div class="col-lg-12">
<div class="bs-component">
<div class="jumbotron">
<h1>{{itemsjson}}</h1>
</div>
</div>
</div>
</div>
</div>
<nav class="navbar navbar-default navbar-fixed-bottom">
<div class="container">
<div class="navbar-head">
<div class = "col-sm-3"></div>
<div class="col-sm-6">
<div class="form-group">
<input class="form-control input-lg" type="text" id="inputLarge">
</div>
</div>
<div class = "navbar-brand">
<div class="col-sm-2">
<div class="form-group">
<button type="submit" class="btn btn-primary">greetings</button>
</div>
</div>
</div>
<div class = "col-sm-1"></div>
</div>
</div>
</nav>
</body>
</html>
Every example online and similar question online seems to imply that this is all correct.
You want to be looping through your results property returned by your json.
<div class ="container" *ngFor="let item of itemsjson?.results">
<div class="row">
<div class="col-lg-12">
<div class="bs-component">
<div class="jumbotron">
<h1>{{item}}</h1>
</div>
</div>
</div>
</div>
</div>
We also are using the safe navigation operator (?) because itemsjson is not initially defined itemsjson?.results
There is nowhere you are using itemsjson in your HTML, probably you need
<div class="jumbotron">
<h1>{{itemsjson | json }}</h1>
</div>
First, check your itemsjson on console.log and just pass it in your template. If you want to read your data in loop use - *ngFor = 'let data of itemsjson;let i = index' and pass {{data}}.