Google지도를 볼 수 있으며지도를 표시하여 다른 개체에서 바인딩 할 수 있습니다. 문제는 내가 didInsertElement
에있는지도 만 인스턴스화 할 수 있기 때문에 (div가 아직 렌더링되지 않았기 때문에 직접 인스턴스화하지 못할 수도 있습니다.)지도의 실제 값에 액세스 할 수 없으며 항상 null을 반환합니다.ember.js보기에서 속성에 액세스 할 수 없습니다.
Places = Ember.Application.create();
Places.MapView = Ember.View.extend({
tagName : 'div',
map : null,
didInsertElement : function() {
this._super();
this.set('map', new google.maps.Map($('#map').get(0), {
mapTypeId: google.maps.MapTypeId.ROADMAP,
center: new google.maps.LatLng(-33.8665433,151.1956316),
zoom: 15
}));
this.get('map'); // Returns the value of the map OK
}
});
Places.searchController = Ember.Object.create({
mapBinding: 'Places.MapView.map' // Doesn't work
}
여기 템플릿의 :
여기 내 코드의
<script type="text/x-handlebars">
{{#view Places.MapView id="map"}}{{/view}}
</script>
내가 MapView
내에서 다른 속성을 설정하면 직접 내가 아무 문제 그것에 바인딩이 없습니다. 이 문제를 해결하는 방법에 대한 아이디어가 있습니까? 에서
내가 시도'Places.mapView = Places.MapView.create ({})'와'{{#view의 Places.mapView 아이디 =} "지도"} {{/보기}} 다음'하지만지도 화면에 나타나지 않습니다. – Johnny