错误this.subnodeSelectAllItemtext.push不是angular2 +中的函数

时间:2018-10-25 13:26:47

标签: angular neo4j

我正在尝试将Angular2 +与Neo4j应用程序集成。 我创建了一个搜索并使用了ng-multiselect-dropdown-它的模块是-

import { NgMultiSelectDropDownModule } from 'ng-multiselect-dropdown';

错误

 ERROR TypeError: this.subnodeSelectAllItemtext.push is not a function
at HierarchySearchComponent.onSelectAllSubNode (hierarchy- 
search.component.ts:155)
at Object.eval [as handleEvent] (HierarchySearchComponent.html:27)
at handleEvent (core.js:11107)
at callWithDebugContext (core.js:12204)
at Object.debugHandleEvent [as handleEvent] (core.js:11907)
at dispatchEvent (core.js:8561)
at eval (core.js:10044)
at SafeSubscriber.schedulerFn [as _next] (core.js:3724)
at SafeSubscriber.__tryOrUnsub (Subscriber.js:253)
at SafeSubscriber.next (Subscriber.js:191)

我使用一个功能-

app.component.ts

onSelectAllSubNode(items: any) {
this.subnodeSelect = true;

console.log("On Item select all" + items);

var subnodeLength = items.length;
console.log("subnodeLength = ", subnodeLength);
this.subnodeSelectAllItem = items;
console.log("subnodeSelectAllItem = ", this.subnodeSelectAllItem);

for (var i = 0; i < items.length; i++) {

  this.subnodeSelectAllItemtext.push(items[i].item_text);
  console.log("subnodeSelectAllItem-text = ", 
   this.subnodeSelectAllItemtext);

  if(i== items.length){
    return;
  }

}

app.component.html

<!-- ng-multiselect-dropdown for SubNodes-->
<div>
  <p  id = "subnode" >Select a SubNode or Multiple Nodes - </p>
  <p style="width:50%">
    <ng-multiselect-dropdown [placeholder]="'Select SubNodes'" [data]="dropdownList" [(ngModel)]="selectedItems" [settings]="dropdownSettings"
      (onSelect)="onItemSelectSubNode($event)" (onSelectAll)="onSelectAllSubNode($event)">
    </ng-multiselect-dropdown>
     </p>
    </div>

图片-

Image of Search Subnode

我在选择全部(即选择所有属性)时出错。请帮助我解决我的错误。

0 个答案:

没有答案