Firenter
Firenter

Reputation: 301

Data isn't a known property

I've looked at other answers and I think I'm doing it right? But still I get this error!

My component looks like this:

import { Component, OnInit, Input } from '@angular/core';

@Component({
  selector: 'app-autocomplete',
  templateUrl: './autocomplete.component.html',
  styleUrls: ['./autocomplete.component.css']
})
export class AutocompleteComponent implements OnInit {

  @Input() datatype: number;

  constructor() { }

  ngOnInit() {
  }

}

The html where I'm calling it looks like this:

<autocomplete [datatype]="2"></autocomplete>

I have used Angular CLI to generate everything so it is all in the module and everything...

Upvotes: 0

Views: 81

Answers (1)

Hamed Baatour
Hamed Baatour

Reputation: 6932

pretty obvious, you used the wrong selector (missing a dash). The selector property in your metadata should match your HTML tag app-autocomplete

Upvotes: 1

Related Questions