私は現在、角度4を新しく使用しており、ツリー構造を得るためにngx-treeview(https://www.npmjs.com/package/ngx-treeview)を使用しています。バインドできる静的データを使用して、ツリーを表示します。角度4 ngx-treeviewのjsonレスポンスとの統合
しかし、それゆえツリー構造を取得するために、残りのサービスを使用する必要がありますがここで
public class TreeviewItem
{
public string Text { get; set; }
public int Value { get; set; }
public bool Collapsed { get; set; }
public TreeviewItem[] Children { get; set; }
}
iは
[{"text":"Core Fields","value":100,"collapsed":false,"children":null}]
角度取得していJSON応答であるNGX-ツリービューから同様のクラスツリービューアイテムを作成しましたサービス:
return this.http.get(this.appHelpersSvc.apiAddress +
"api/module/getStandardFields", { headers: httpHeaders })
.map((response:Response) => <TreeviewItem>response.json());
角度コンポーネント
私はUncaught TypeError: this.items[i].getCheckedItems is not a function
at TreeviewComponent.getCheckedItems (http://localhost:4001/main.bundle.js:42763:107)
at TreeviewComponent.raiseSelectedChange (http://localhost:4001/main.bundle.js:42745:34)
at TreeviewComponent.ngOnChanges (http://localhost:4001/main.bundle.js:42703:22)
at checkAndUpdateDirectiveInline (http://localhost:4001/vendor.dll.js:12160:19)
at checkAndUpdateNodeInline (http://localhost:4001/vendor.dll.js:13586:17)
at checkAndUpdateNode (http://localhost:4001/vendor.dll.js:13525:16)
at debugCheckAndUpdateNode (http://localhost:4001/vendor.dll.js:14228:59)
at debugCheckDirectivesFn (http://localhost:4001/vendor.dll.js:14169:13)
ない間違って起こっているかを理解することを得ているそう
itemsList: TreeviewItem[];
this.moduleService.getStandardFields().subscribe(data => {this.itemsList = data;});
。助けていただきありがとうございます。
ようこんにちは、レオVoの操作を実行して解決策を持って、あなたは素晴らしいツールを作った、私はどのように私は、デフォルトですべてのチェックボックスのチェックを外すことができます知っているかもしれません。 – Karty
こんにちは、データベースからチェック項目の値を取得するときに、チェックボックスの値を設定するにはどうすればよいですか?私はそれをしようとしています:this.values = this.claims.map(x => x.checkedId);結果はありません。手伝って頂けますか ?ありがとうございました –