Primeng: Error with dropdown component, Can't bind to 'ngModel'

Created on 30 Sep 2016  路  3Comments  路  Source: primefaces/primeng

I may be doing something wrong, I missed any import or something like that, and that's why it's trowing the error, so if you can help me, I'd really appreciate it.
If it's a bug, then I hope it can be fixed soon :)

Well, the error in the console
"Can't bind to 'ngModel' since it isn't a known property of 'p-dropdown'."

Dependencies:
Anguar*: 2.0.1
primeng: 1.0.0-beta.16

My app module and component are:
App.module:
`
//...Imports
import { TabMenuModule, DataTableModule, SharedModule, ContextMenuModule, DropdownModule } from 'primeng/primeng';

@NgModule({
imports: [
...someModules,
DataTableModule,
SharedModule,
ContextMenuModule,
DropdownModule
],
declarations: [
...Compoenents,
...Directives
],
providers: [
...Services
],
bootstrap: [MainComponent]
})
`

component.ts:
`
import { Component } from '@angular/core';
import { GenericWebService } from '../../../services';
import { MenuItem, SelectItem } from 'primeng/primeng';

@Component({
selector: 'component',
templateUrl: './component.html',
styleUrls: ['./component.css']
})
export class Component {

//DEFINE DROPDOWN
selectedElementType: string;
dropdownElements: SelectItem[] = new Array();

constructor(
    private genericService: GenericWebService
) {
    this.genericService.getAvailableTables()
        .map(elementType => {
            this.dropdownElements.push({ label: elementType.descValue, value: elementType });
        });
}

}
compoenent.html:

Selected Element Type: {{selectedElementType ? selectedElementType.keyValue + ' -- ' + selectedElementType.descValue : 'none'}}

`

Most helpful comment

Are you importing FormsModule from angular?

All 3 comments

Are you importing FormsModule from angular?

ops, my fault, many thanks @erikaoctavia ! 馃槃

shouldn't this be mentioned in the PrimeNG documentation? I've been having this problem a few times lately, since it isn't mentioned on the website

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lilling picture lilling  路  3Comments

Helayxa picture Helayxa  路  3Comments

gatapia picture gatapia  路  3Comments

pchristou picture pchristou  路  3Comments

miresk picture miresk  路  3Comments