My html page is not showing data from my component.ts file. The variable console.log(array_no1); is holding the objects, I want to show its array_no1["title"] value on html page in a table. Attaching the console.log picture:
My slist.component.ts below
import { Component, OnInit, Inject } from '@angular/core';
import { DOCUMENT } from '@angular/platform-browser';
declare let $: any;
@Component({
selector: 'app-showlist',
templateUrl: './showlist.component.html',
styleUrls: ['./showlist.component.css']
})
export class ShowlistComponent implements OnInit {
constructor(@Inject(DOCUMENT) private document: any) {}
ngOnInit() {
var keys = Object.keys(localStorage).filter(function(key) {
return /^section\d+$/.test(key);
});
var dataArray = keys.map(function(key) {
return JSON.parse(localStorage.getItem(key));
});
for(var i=0;i<dataArray.length;i++){
var array_no = dataArray[i];
}
var array_no1 = dataArray;
console.log(array_no1);
}
}
My slist.component.html
<tr *ngFor="let item of array_no1">
<td>{{item}}</td>
</tr>
Basically I want the title's each in 1 row.
