angular - Angular2 using threejs Orbitcontrols -


i'm trying use threejs exemple inside angular (cli) 2 app.

so have installed threejs :

npm install 3 --save 

then added typings :

npm install @types/three --save-dev 

finally component looks :

import { component, oninit } '@angular/core'; import * 3 'three';  @component({     selector: 'app-testthreejs',     templateurl: './testthreejs.component.html',     styleurls: ['./testthreejs.component.css'] }) export class testthreejscomponent implements oninit { // } 

with can use functionality 3 without problem.

i use of exemple available in node_modules/three/examples/js/ , more precisely orbitcontrol. typings give me autocompletion in visual studio code : vscode

but tried use have following error :

typeerror: webpack_imported_module_1_three.orbitcontrols not constructor

is there way make available orbitcontrols (and other exemples) via import ? should include control.js in html ?

what's best way deal ?

finally found solution :

1- install orbitcontrols via npm :

npm install three-orbit-controls --save 

2- import 3 , orbitcontrols in component :

import * 3 'three'; var orbitcontrols = require('three-orbit-controls')(three) 

i can

this.controls = new orbitcontrols(this.camera,this.renderer.domelement); 

Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -