My code is simple a button that shows a list but I do not understand the error that throws me just says
ERROR Error: "StaticInjectorError(AppModule)[NgIf -> TemplateRef]:
StaticInjectorError(Platform: core)[NgIf -> TemplateRef]:
NullInjectorError: No provider for TemplateRef!"
What is the error in the code?
my component
import { Component, OnInit } from '@angular/core';
import { Pelicula} from '../modelo/pelicula';
@Component({
selector: 'app-lista-peliculas',
templateUrl: './lista-peliculas.component.html',
styleUrls: ['./lista-peliculas.component.css']
})
export class ListaPeliculasComponent {
public pelicula:Pelicula;
public mostrarDatos:boolean;
constructor() {
this.pelicula = new Pelicula(1, "El caballero de la Noche", "Christopher Nolan", 2008 );
this.anuncio();
this.mostrarDatos = false;
}
anuncio(){
console.log(this.pelicula);
}
botonMostrar(){
this.mostrarDatos = true;
}
}
and my html
<h2 class="titulo-lista">Listado de Peliculas</h2>
<button (click)="botonMostrar()">mostrar peliculas</button>
<ul ngIf="mostrarDatos === true">
<li>Pelicula: {{pelicula.titulo}}</li>
<li>Director: {{pelicula.director}}</li>
<li>Anio: {{pelicula.anio}}</li>
</ul>