It's my first day of learning angular and I've encountered a very unintuitive error message, which says:
Uncaught Error: Template parse errors: Unexpected closing tag "p". It may happen when the tag has already been closed by another tag. For more info see https://www.w3.org/TR/html5/syntax.html#closing-elements-that-have-implied-end-tags (" Number {{ i + 1 }}: {{ phoneNumber }} [ERROR ->]
"): ng:///AppModule/AddressCardComponent.html@5:0
The error is thrown on a valid html template that looks like this:
<p>Phones:</p>
<p *ngFor="let phoneNumber of user.phone; index as i">
<h3>
Number {{ i + 1 }}: {{ phoneNumber }}
</h3>
</p>
and in the component itself it just looks like this:
@Component({
selector: 'app-address-card',
templateUrl: './address-card.component.html',
styleUrls: ['./address-card.component.scss']
})
export class AddressCardComponent implements OnInit {
user: any;
constructor() {
this.user = {
name: 'Foo Bar',
title: 'Software Developer',
address: '1234 Main St., State, City 610010',
phone: [
'123-123-1234',
'456-546-4574'
]
}
}
ngOnInit() {
}
}
The cool thing is that if I change the inner h3 tag to a span or a, it works perfectly as expected, whereas when the inner tag is p, h3, h2, h1, div etc it just breaks with the same error.
It seams it just doesn't like certain kinds of tags, lol
Anyway,
Am I doing something wrong here? If so, how should I correct the template? What do I miss?
Are there many situations when that much unintuitive error messages come up while developing angular apps?
PS: I'm using Angular v7.0.5 if it makes any difference