inspirsea / tree-ngx

A highly customizable Angular Tree Component usable with minimal implementation
http://emilsunesson.com/code/tree-ngx-intro
MIT License
22 stars 7 forks source link

I can't import (TreeNgxComponent) any more in the new V3 like V2 #8

Closed myalsailamy closed 4 years ago

myalsailamy commented 4 years ago

i can't import (TreeNgxComponent) any more in the new version 3 with angular 8 like version 2.

I use to use it like this : import { TreeMode, NodeItem, TreeOptions, TreeNgxComponent } from 'tree-ngx';

to use it like this: @ViewChild('firstTreeRef', {static: true}) TreeRef: TreeNgxComponent;

now when i updated my project the angular give me this error : error TS2305: Module '"MyApp/node_modules/tree-ngx/tree-ngx"' has no exported member 'TreeNgxComponent'.


or could you give me way to use type TreeNgxComponent in my app .

myalsailamy commented 4 years ago

After going deep, I found that you change (TreeNgxComponent) alias to (ɵa) at project node_modules file tree-ngx.d.ts code: export { TreeNgxComponent as ɵa } from './src/tree-ngx/tree-ngx.component';

Now i use it like this :

import { TreeMode, NodeItem, TreeOptions, ɵa } from 'tree-ngx';
@ViewChild('firstTreeRef', {static: true}) TreeRef: ɵa;

I would be grateful if you going to change the alias to a clear name in the next release?!, i well waiting the next version.

thanks.

inspirsea commented 4 years ago

Use the interface instead, Like @ViewChild('firstTreeRef') firstTreeRef: TreeNgx;

myalsailamy commented 4 years ago

that was not work for me, because i need to access direct to treeService to use yours functions like this :

this.TreeRef.treeService.treeState
this.TreeRef.treeService.clear();
this.TreeRef.treeService.checkBoxClick(result);
inspirsea commented 4 years ago

Well, you are using internal methods. The correct way would be for you to issue a feature request for the functionality you are trying to achieve

myalsailamy commented 4 years ago

I already asked in #6

inspirsea commented 4 years ago

AH you are right ofcourse, sorry must have slipped my attention

inspirsea commented 4 years ago

You do have selectById as referenced in http://emilsunesson.com/docs/tree-ngx/tree-ngx-api

myalsailamy commented 4 years ago

many thanks