Skip to content

Commit 7ca89ff

Browse files
committed
fix example product.component
1 parent 09ac4a8 commit 7ca89ff

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/app/product/product.component.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Component, Injectable, OnInit, ViewChild } from '@angular/core';
22
import { isNil, remove, reverse } from 'lodash';
33
import {
4-
TreeviewI18n, TreeviewItem, TreeviewConfig, TreeviewHelper, TreeviewComponent,
4+
TreeviewItem, TreeviewConfig, TreeviewHelper, TreeviewComponent,
55
TreeviewEventParser, OrderDownlineTreeviewEventParser, DownlineTreeviewItem
66
} from 'ngx-treeview';
77
import { ProductService } from './product.service';
@@ -55,20 +55,16 @@ export class ProductComponent implements OnInit {
5555
}
5656

5757
removeItem(item: TreeviewItem): void {
58-
let isRemoved = false;
5958
for (const tmpItem of this.items) {
6059
if (tmpItem === item) {
61-
this.items = remove(this.items, item);
60+
remove(this.items, item);
6261
} else {
63-
isRemoved = TreeviewHelper.removeItem(tmpItem, item);
64-
if (isRemoved) {
62+
if (TreeviewHelper.removeItem(tmpItem, item)) {
6563
break;
6664
}
6765
}
6866
}
6967

70-
if (isRemoved) {
71-
this.treeviewComponent.raiseSelectedChange();
72-
}
68+
this.treeviewComponent.raiseSelectedChange();
7369
}
7470
}

0 commit comments

Comments
 (0)