I am trying to show some data but Angular only displays empty bullet points. I get the error that says "Cannot read the property of 0 undefined". The code seems ok to me but is not working. What is wrong?
The code I have is:
a) Offer.ts
export class Offer
{
constructor(
public id : number,
public title : string,
public owner : string,
public productOffer : [ {'id': number, 'name': string} ]) {}
}
b) offer.component.ts
<!-- language: lang-js -->
import { Component, OnInit } from '@angular/core';
import { Offer } from '/offer';
import { RouterModule, Routes } from '@angular/router';
import { NgModule } from "@angular/core";
import { BrowserModule } from "@angular/platform-browser";
@Component({
selector : 'app-offers',
templateUrl: './offers.html',
styleUrls : ['./offers.scss']
})
export class OffersComponent implements OnInit {
public offers: Offer[];
constructor() {
this.offers = [
{
id : 1,
title : 'Offer 01',
owner : 'Mr Owner',
productOffer : [
{ id : 1, name: 'Soap'},
{ id : 2, name: 'Cover'},
]
},
{
id : 2,
title : 'Offer 01',
owner : 'Mr Owner2',
productOffer : [
{ id : 1, name: 'Soap2'},
{ id : 2, name: 'Cover2'},
]
}];
}
ngOnInit() { }
}
c) offer.component.html
<ul ng-repeat="offer in offers">
<li>example</li>
<li><h1>{{ offer.owner }}</h1></li>
<li>{{offer.title}}</li><br><br>
<li><button>{{offer.id}}</button></li>
</ul>
d) I have also tried:
<ul>
<li>example</li>
<li *ngFor="let offer of offers">{{ offer.owner }}</li>
</ul>
The output I am getting with both is:
And this error:
Thanks for any help. I have been hours trying to fix it but I do not understand why is not working.


ng-repeat, which are definitely angular 1.x. however, your js is importing@angular/core, which is absolutely angular 2.x . These frameworks are not the same, and are essentially 3rd cousins. You can't mix the two syntax under normal circumstances. of course someone else changed the tag, but you still haveng-repeatin the code.ng-repeatto*ngFor.tendersarray defined anywhere.import { Tender } from '/offer';