I'm using Angular2 and A-Frame to design a web application which displays virtual scene. But it seems data binding feature of Angular does not work with a-frame entity
I bind image url to [src] attribute of entity as the following:
====>>> sim.component.html
<a-scene>
<a-entity camera look-controls position="10 0 8" rotation="0 20 0">
</a-entity>
<a-plane *ngFor="let item of layers; let i = index" width="10" height="6"
src={{imageURL}} position="0 0 {{-3*i + 3}}">
</a-plane>
</a-scene>
====>>> sim.component.ts
@Component({
templateUrl: './sim.component.html',
selector: 'sim-tag',
providers: [SimService]
})
export class SimComponent implements OnInit {
imageURL: string;
layers: Object[];
constructor(private service: SimService, private config: Configuration){}
ngOnInit() {
this.layers = [1, 2, 3, 4, 5, 6];
this.imageURL = "http://localhost/images/test.jpg";
}
}
When run application, I think it should generate an a-plane entity like
<a-plane height="6" width="10"
ng-reflect-src="http://localhost/images/test.jpg" src="http://localhost/images/test.jpg"
ng-reflect-position="0 0 0" position="0 0 0" >
</a-plane>
but actually it is
<a-plane height="6" width="10"
ng-reflect-src="http://localhost/images/test.jpg"
ng-reflect-position="0 0 0" position="">
</a-plane>
there is no "src" and "position" attribute, hence, plane image display nothing.
I made a demo here: https://plnkr.co/edit/t6YhZy5gCzgycaYVeGrt?p=preview
Please help. Thanks.