Can't import A-frame into component - Angular2

后端 未结 1 391
悲&欢浪女
悲&欢浪女 2020-12-21 06:25

I have a project created with angular-cli where I have installed aframe via npm install aframe --save, and when I try to import it in

相关标签:
1条回答
  • 2020-12-21 07:03

    Here is what you have to get it properly working in Angular2:

    1. Edit your angular-cli.json and add the path to the scripts node:
    "scripts": [
      "node_modules/aframe/dist/aframe-master.js"
    ],
    
    1. Download the typings from https://github.com/devpaul/aframe-typings/blob/master/src/AFRAME.d.ts.

    2. Reference the typings in your component with:

    /// <reference path="../typings/AFRAME.d.ts" />
    

    or install the typings globally in your tsconfig.json:

    "files": [
        "typings/AFRAME.d.ts"
      ]
    
    0 讨论(0)
提交回复
热议问题