Skip to content

Not able to use ngIf/ngFor directives in project #1126

Description

@AlbertoHdezCerezo

Hi everyone,

Recently I started working on Angular 2 with this project.

I am trying to set up a simple template with some ng directives, and whenever I include them in my HTML a parsing error appears:

<div [ngIf]="videoList.length === 0" class="video-list ui basic segment center aligned">
    <h1 class="ui header">
        <img src="" class="ui medium image">
        <div class="content">
            Media Content
            <div class="sub header">Manager</div>
        </div>
    </h1>
</div>
import { Component } from '@angular/core';

import Video from '../../funke-base/models/Video';

@Component({
  selector: 'funke-video-search',
  styleUrls: [ '../resources/scss/video-list.scss' ],
  templateUrl: '../resources/html/video-list.tpl.html',
})
export class VideoListComponent {

    public videoList: Video[];
    public currentPage: number = 1;

    constructor() {
        this.videoList = [];
    }
}

With this code I always get the error:

main.browser.ts:25 Error: Template parse errors:
Can't bind to 'ngIf' since it isn't a known property of 'h1'.

When I remove the ngIf directive from the code it works great. Is there something I am doing wrong/any problem with my configuration?

Activity

  1. AlbertoHdezCerezo commented on Oct 25, 2016

    @AlbertoHdezCerezo
    Author

    Done, sorry was not importing the proper modules

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions