HiveBrain v1.2.0
Get Started
← Back to all entries
debugtypescriptangularCritical

Exception: Can't bind to 'ngFor' since it isn't a known native property

Submitted by: @import:stackoverflow-api··
0
Viewed 0 times
bindpropertyknownnativeisnsinceexceptioncanngfor

Problem

What am I doing wrong?

import {bootstrap, Component} from 'angular2/angular2'

@Component({
  selector: 'conf-talks',
  template: `
     {{talk.title}} by {{talk.speaker}}
     {{talk.description}}
   `
})
class ConfTalks {
  talks = [ {title: 't1', speaker: 'Brian', description: 'talk 1'},
            {title: 't2', speaker: 'Julie', description: 'talk 2'}];
}
@Component({
  selector: 'my-app',
  directives: [ConfTalks],
  template: ''
})
class App {}
bootstrap(App, [])


The error is

EXCEPTION: Template parse errors:
Can't bind to 'ngFor' since it isn't a known native property
("]*ngFor="talk of talks">

Solution

I missed let in front of talk:




Note that as of beta.17 usage of #... to declare local variables inside of structural directives like NgFor is deprecated. Use let instead.

` now becomes

Original answer:

I missed
# in front of talk:




It is so easy to forget that
#. I wish the Angular exception error message would instead say:
you forgot that # again`.

Context

Stack Overflow Q#34012291, score: 786

Revisions (0)

No revisions yet.