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'}}
`
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
Most helpful comment
Are you importing FormsModule from angular?