ras*_*hmi 4 three.js angular2-directives angular
我试图将three.js场景集成到一个有角度的2页.我是Angular 2和javascript的初学者,我在script.html中包含了脚本标签中的three.js文件,即在scene.component.ts文件中我有这样的代码...
//scene.component.ts
import { Component } from 'angular2/core';
import { THREE } from 'three-js/three';
@Component({
selector: 'ps-scene',
templateUrl: 'app/webgl/scene.component.html'
})
export class SceneComponent{
scene = new THREE.Scene();
}
///////////////
Run Code Online (Sandbox Code Playgroud)
问题在于显示 - 从'three-js/three'导入{THREE};
它与'angular2/core'位于相同的目录路径中
提前致谢.
你使用角度cli?
如果是这样,请不要忘记在typings.d文件中添加引用:
declare module 'three';
Run Code Online (Sandbox Code Playgroud)
https://github.com/angular/angular-cli#3rd-party-library-installation
3rd Party Library Installation
Simply install your library via npm install lib-name --save and import it in your code.
If the library does not include typings, you can install them using npm:
npm install d3 --save
npm install @types/d3 --save-dev
If the library doesn't have typings available at @types/, you can still use it by manually adding typings for it:
// in src/typings.d.ts
declare module 'typeless-package';
// in src/app/app.component.ts
import * as typelessPackage from 'typeless-package';
typelessPackage.method();
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
10593 次 |
| 最近记录: |