A框架未从Angular加载资产 [英] A-Frame not loading assets from Angular
问题描述
问题是当我尝试从以下位置在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屋!