遵循指南:https://www.primefaces.org/primeng/ 我已经尝试按照上面详述的步骤安装PrimeNG以与Angular4一起使用,但是我收到了错误:
r1 = 1; r2 = 5; % Radii of your circles
x_0 = 0; y_0 = 0; % Centre of circles
[x,y] = meshgrid(x_0-r2:0.2:x_0+r2,y_0-r2:0.2:y_0+r2); % meshgrid of points
U = cos(x)./sqrt(x.^2+y.^2);
V = sin(x)./sqrt(x.^2+y.^2);
streamslice(x,y,U,V);
我尝试重建项目,正如其他帖子中所建议的那样,但它对我不起作用。任何提示?
以下是所有细节:
- PrimeNg安装
'p-dropdown' is not a known element:
- file:testdropdown.component.html
npm install primeng --save
- file:testdropdown.component.ts
<p-dropdown [options]="cities" [(ngModel)]="selectedCity"></p-dropdown>
- 错误:
import { DropdownModule } from 'primeng/primeng';
import { Component, OnInit } from '@angular/core';
import { SelectItem } from 'primeng/primeng';
@Component({
selector: 'app-testdropdown',
templateUrl: './testdropdown.component.html',
styleUrls: ['./testdropdown.component.css']
})
export class TestdropdownComponent implements OnInit {
cities: SelectItem[];
selectedCity: string;
constructor() {
this.cities = [];
this.cities.push({ label: 'Select City', value: null });
this.cities.push({ label: 'New York', value: { id: 1, name: 'New York', code: 'NY' } });
this.cities.push({ label: 'Rome', value: { id: 2, name: 'Rome', code: 'RM' } });
}
ngOnInit() {
}
}
答案 0 :(得分:11)
在您声明组件的模块中导入下拉模块。
import {DropdownModule} from 'primeng/primeng';
@NgModule({
imports: [
DropdownModule
],
declarations: [TestdropdownComponent ]
})
export class myModule { }
答案 1 :(得分:4)
如果此问题仍然存在,您可能需要再测试一件事,即,如果导入“FormsModule”,如果不导入它并尝试,
import { FormsModule } from '@angular/forms';
import { DropdownModule } from 'primeng/primeng';
@NgModule({
imports: [
DropdownModule,
FormsModule
],
这应该可以解决问题。
答案 2 :(得分:1)
您必须在应用模块的DropdownModule
部分或宣布imports
的模块中添加TestdropdownComponent
。
答案 3 :(得分:1)
RestTemplate restTemplate = new RestTemplate();
List<ClientHttpRequestInterceptor> interceptors = Arrays.asList(new CustomHttpRequestInterceptor())
restTemplate.setInterceptors(interceptors);
import {DropdownModule,AccordionModule,SharedModule, ButtonModule, 面板模块 RadioButtonModule, 消息模块 KeyFilterModule, FieldsetModule, MessageModule, CalendarModule}来自“ primeng / primeng”;
Root module file like: app.module.ts. Added something like that.