[英]Can't bind to 'theme' since it isn't a known property of 'jqxTree'
I am using jqxTreeComponent in angular 7 after running below code and cofiguring some setting i am getting this error when doing ng serve. 我在下面的代码中运行并配置一些设置后在角度7中使用jqxTreeComponent,在执行ng服务时遇到此错误。
npm install jqwidgets-scripts --save
I am getting this error when doing ng serve. 执行ng服务时出现此错误。
this is my compoenent template code :
这是我的组件模板代码:
<div class="tree-container">
<jqxTree class="tree-container--item" [theme]="'material'" #myTree [width]="300" [height]="450" [source]="records"
[rtl]="true">
</jqxTree>
<div class="tree-container--item">
<div fxLayout="row">
<jqxButton [theme]="'material'" (onClick)="AddNode($event)" [width]="125" [height]="25">add</jqxButton>
<input [(ngModel)]="nodeName" *ngIf="showTextBox" placeholder="add" />
</div>
</div>
in addition i added below code in ts file of my component (of course in right place!!) 另外,我在组件的ts文件中添加了以下代码(当然在正确的位置!)
import { jqxTreeComponent } from 'jqwidgets-scripts/jqwidgets-ts/angular_jqxtree';
@ViewChild('myTree') myTree: jqxTreeComponent;
beside this step i added two component in decleration section in app.module.ts file: 在这一步旁边,我在app.module.ts文件的decleration部分添加了两个组件:
import { jqxButtonComponent } from 'jqwidgets-scripts/jqwidgets-ts/angular_jqxbuttons';
import { jqxTreeComponent } from 'jqwidgets-scripts/jqwidgets-ts/angular_jqxtree';
jqxButtonComponent, jqxTreeComponent
and as final step i added below code to my tscodfig file: 最后一步,我在tscodfig文件中添加了以下代码:
"include": [
"src/**/*"
],
"files": [
"src/app/app.module.ts",
"node_modules/jqwidgets-scripts/jqwidgets-ts/angular_jqxbuttons.ts",
"node_modules/jqwidgets-scripts/jqwidgets-ts/angular_jqxtree.ts"
]
Everything seems to be right now i want to know what is the problem??!!! 现在一切似乎都正确了,我想知道出什么问题了?
I have few suggestions please try, hope it helps 我没有什么建议,请尝试,希望对您有所帮助
Make a JqxWidgetsModule 制作一个JqxWidgetsModule
import { jqxButtonComponent } from 'jqwidgets-scripts/jqwidgets-ts/angular_jqxbuttons'; 从'jqwidgets-scripts / jqwidgets-ts / angular_jqxbuttons'导入{jqxButtonComponent};
import { jqxTreeComponent } from 'jqwidgets-scripts/jqwidgets-ts/angular_jqxtree'; 从'jqwidgets-scripts / jqwidgets-ts / angular_jqxtree'导入{jqxTreeComponent};
@NgModule({ @NgModule({
declarations: [ jqxButtonComponent, jqxTreeComponent], 声明:[jqxButtonComponent,jqxTreeComponent],
exports: [ jqxButtonComponent, jqxTreeComponent] 导出:[jqxButtonComponent,jqxTreeComponent]
}) })
export class JqxWidgetsModule { } 导出类JqxWidgetsModule {}
Import this module in your LocationModule 将此模块导入您的LocationModule中
@NgModule({
declarations: [...],
imports: [
CommonModule,
LocationRoutingModule,
JqxWidgetsModule
]
})
export class LocationModule { }
In tsconfig.json file after compilerOptions property add the below config: 在编译器选项属性之后的tsconfig.json文件中,添加以下配置:
"include": [ "src/**/*.ts", "node_modules/jqwidgets-scripts/jqwidgets-ts/angular_jqxbuttons.ts", "node_modules/jqwidgets-scripts/jqwidgets-ts/angular_jqxtree.ts" ]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.