A框架未从Angular加载资产 [英] A-Frame not loading assets from Angular

查看:65
本文介绍了A框架未从Angular加载资产的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

用离子和角度对a框架进行即时测试。我得到一个框架,它们可以很好地运行,甚至可以在我的设备上尝试并且看起来很棒。



问题是当我尝试从以下位置在a-sky上加载img时出现的



我得到了这个工作:

  < ion-content> 
< a-scene>
< a-sky src = assets / puydesancy.jpg rotation = 0 -130 0>< / a-sky>
< / a-scene>
< / ion-content>

但是,如果我尝试这样做:

 < a-scene> 
< a-assets>
< img id = sky [src] = myImgPath>
< / a-assets>
< a-sky src =#sky>< / a-sky>
< / a-scene>

不工作并获取此日志消息:


THREE.webglrenderer 83


似乎a帧无法以这种方式加载图像但是不知道为什么。



预先感谢。

解决方案

您使用的是A-Frame版本?您确定 myImgPath 指向正确的资源位置,还是组件中的属性键入正确?



我整理了 punkr例如,它可以在 a-sky 以及Angular和A-Frame 0.5.0上正确显示图像源。



可能有用的是改为使用 [attr。*]

 < a-assets> 
< img id = sky [attr.src] = myImgPath>
< / a-assets>

我不是离子框架的专家,但我认为它在<$上应该可以正常工作c $ c> ng-template 。


im testing a-frame with ionic and angular. I get a-frame runs great with them, even tried on my device and looks awesome.

The problem comes when i try to load an img on the a-sky from a property of the component.

I got this working:

<ion-content>
    <a-scene>
      <a-sky src="assets/puydesancy.jpg" rotation="0 -130 0"></a-sky>
    </a-scene>
</ion-content>

But if i try this:

<a-scene>
  <a-assets>
    <img id="sky" [src]="myImgPath">
  </a-assets>
  <a-sky src="#sky"></a-sky>
</a-scene>

Don't work and get this log message:

THREE.webglrenderer 83

Seems that a-frame cant load the image coming this way but dont know why.

Thanks in advance.

解决方案

What version of A-Frame are you using? Are you sure myImgPath points to the right resourcelocation or the attribute in your component is typed correctly?

I've put together a plunkr example, it correctly displays the image source on an a-sky in conjunction with Angular and A-Frame 0.5.0.

What might help is to use [attr.*] instead.

<a-assets>
    <img id="sky" [attr.src]="myImgPath">
</a-assets>

I am not formiliar with the ionic framework, but I would assume it should work just fine with ng-template.

这篇关于A框架未从Angular加载资产的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆