Closed pascal08 closed 7 years ago
Problem:
I'm trying to load angular-ui-tree into a custom component.
package.json
{ ... "dependencies": { ... "@types/angular-ui-tree": "^2.8.30", "angular-ui-tree": "^2.22.5", ... }, ... }
What I have tried:
custom.module.ts
const uiTree = require('angular-ui-tree');
Result: angular-ui-tree is loaded, but throws the following error:
Uncaught ReferenceError: angular is not defined
import * as uiTree from 'angular-ui-tree';
tsconfig.json
{ "compilerOptions": { ... "typeRoots": [ "node_modules/@types" ], "types": ["angular-ui-tree"] } ... }
Result: throws error:
File '.../node_modules/@types/angular-ui-tree/index.d.ts' is not a module.
Bottom line
I would like to know how to import a npm package.
Thanks in advance.
I realised this question is not relevant since angular-ui-tree is an Angular 1 package. Therefore I'm closing it. Instead I used this package: angular-tree-component
Problem:
I'm trying to load angular-ui-tree into a custom component.
package.json
What I have tried:
custom.module.ts
Result: angular-ui-tree is loaded, but throws the following error:
custom.module.ts
tsconfig.json
Result: throws error:
Bottom line
I would like to know how to import a npm package.
Thanks in advance.