I have installed PrimeNg. I am using p-autoComplete
component but this error occurs now. I checked everywhere but couldn't find anything. Also, all I was just trying to replicate one of offical PrimeNg demo. p-autocomplete component.
1 - I've installed PrimeNg like this.
npm install primeng --save
npm install primeicons --save
2 - I have added the module to my app.component.ts file like this.
import { AutoCompleteModule } from 'primeng/autocomplete';
//other imports
@NgModule({
declarations: [
AppComponent,
HomeComponent
],
imports: [
BrowserModule,
AutoCompleteModule
],
providers: [CountryServiceService],
bootstrap: [AppComponent]
})
export class AppModule { }
3 - using Angular Cli I have created a service and added demo code from primeNg official website.
4 - I have showed my service in my app.component.ts file like this.
import { CountryServiceService } from './country-service.service';
...
providers: [CountryServiceService],
...
5 - Created a component called home and in the home.component.html I copied and pasted official website deme code.
<h3 class="first">Basic</h3>
<p-autoComplete [(ngModel)]="country"
[suggestions]="filteredCountriesSingle" (completeMethod)="filterCountrySingle($event)" field="name" [size]="30" placeholder="Countries" [minLength]="1"></p-autoComplete>
<span style="margin-left:10px">Country: {{country ? country.name||country : 'none'}}</span>
<h3>Advanced</h3>
<p-autoComplete [(ngModel)]="brand" [suggestions]="filteredBrands" (completeMethod)="filterBrands($event)" [size]="30" [minLength]="1" placeholder="Hint: type 'v' or 'f'" [dropdown]="true">
<ng-template let-brand pTemplate="item">
<div class="ui-helper-clearfix" style="border-bottom:1px solid #D5D5D5">
<img src="assets/showcase/images/demo/car/{{brand}}.png" style="width:32px;display:inline-block;margin:5px 0 2px 5px" />
<div style="font-size:18px;float:right;margin:10px 10px 0 0">{{brand}}</div>
</div>
</ng-template>
</p-autoComplete>
<span style="margin-left:50px">Brand: {{brand||'none'}}</span>
<h3>Multiple</h3>
<span class="ui-fluid">
<p-autoComplete [(ngModel)]="countries" [suggestions]="filteredCountriesMultiple" (completeMethod)="filterCountryMultiple($event)" styleClass="wid100"
[minLength]="1" placeholder="Countries" field="name" [multiple]="true">
</p-autoComplete>
</span>
<ul>
<li *ngFor="let c of countries">{{c.name}}</li>
</ul>
6 - in the home.component.ts file I copied and pasted official website demo code.
7 - in the app.component.html I added my home component to see if everything works.
So, I did these steps and I am not getting the desired behavior or I cant even see a rendered html page.
When I inspect the page I get the following error
So, WHAT IS IT THAT I AM DOING WRONG. SERIOUSLY!... STUPID PrimeNg