尊敬的stackoverflow社区!
我正在处理nativescript角度项目,并且尝试使用NativescriptUIDataform插件。安装和实施确实起作用。我通过NativescriptUIDataform得到了一个生成的表单。
package.json:
"nativescript-ui-dataform": "^3.7.0",
app.module.ts:
import { NativeScriptUIDataFormModule } from "nativescript-ui-dataform/angular";
...
@NgModule({
...
imports: [
...
NativeScriptUIDataFormModule
...
我的newEntry.component.ts看起来像这样:
import { Component, OnInit } from "@angular/core";
import { RouterExtensions } from "nativescript-angular/router";
import { Entry } from "./entry";
@Component({
selector: "newEntry",
moduleId: module.id,
templateUrl: "./newEntry.component.html"
})
export class NewEntryComponent implements OnInit {
private _entry: Entry;
constructor(private routerExtensions: RouterExtensions) {
}
get entry(): Entry {
return this._entry;
}
set entry(value: Entry) {
this._entry = value;
}
public goBack() {
this.routerExtensions.backToPreviousPage();
}
ngOnInit() {
}
}
在我的newEntry.component.html中,我有以下内容:
<RadDataForm [source]="entry" tkExampleTitle tkToggleNavButton></RadDataForm>
到目前为止,没有出现问题。应用程序中会自动生成一个表单。但是,当我尝试使用HTML编辑器时,没有任何更改,只会显示自动生成的表单。我是否必须实现另一个模块?使用编辑器我犯了什么错?
我的带有编辑器的newEntry.component.html看起来像这样:
<RadDataForm [source]="entry" tkExampleTitle tkToggleNavButton>
<TKEntityProperty tkDataFormProperty name="date" displayName="Date" index="0"></TKEntityProperty>
<TKEntityProperty tkDataFormProperty name="credit" displayName="Creditaccount" index="1" valuesProvider="something, something">
<TKPropertyEditor tkEntityPropertyEditor type="Picker"></TKPropertyEditor>
</TKEntityProperty>
<TKEntityProperty tkDataFormProperty name="debit" displayName="Debitaccount" index="2" valuesProvider="something, something">
<TKPropertyEditor tkEntityPropertyEditor type="Picker"></TKPropertyEditor>
</TKEntityProperty>
<TKEntityProperty tkDataFormProperty name="value" displayName="Value" index="3" type="number"></TKEntityProperty>
<TKEntityProperty tkDataFormProperty name="description" displayName="Description" index="4"></TKEntityProperty>
</RadDataForm>
谢谢您的答复!
答案 0 :(得分:0)
似乎您正在加载没有所有指令的模块。
app-routing-module.ts
...
{ path: "newEntry", loadChildren: "~/app/newEntry/newEntry.module#NewEntryModule" }
...
尝试将NativeScriptUIDataFormModule
而不是app.module.ts
导入声明NewEntryComponent(newEntry.module.ts)的模块中
欢呼