0
這個錯誤比較時嘗試在我看來啓動功能PROVA:遺漏的類型錯誤:無法讀取的未定義的屬性「元素」。 錯誤發生在線路的:var =地圖新google.maps.Map(document.get.Element.By.Id( 'pagina'),選項);谷歌地圖API和骨幹錯誤
var HomeView = Backbone.View.extend({
template: Handlebars.compile(template),
events: {
"click .log_out":"log_out",
"click .prove":"prove",
'orientationchange' : 'onOrientationChange'
},
initialize: function() {
console.log("inhomeview");
this.render();
},
render: function() {
//var context = JSON.parse(JSON.stringify(this.model));//eliminare
var context=this.model;
var html =this.template(context);
console.log(html);
$('#pagina').empty();
$('#pagina').append(this.$el.html(html));
return this;
},
onOrientationChange: function() {
if(window.orientation == 90 || window.orientation == -90) {
//you are in landscape zone
//do whatever you want to do
}
},
log_out:function(){
console.log("logout");
Parse.User.logOut();
// new AppView;//ERRORE UNDEFINED NOT A FUNCTION
window.location='index.html' ;//METTERE UNA NEW APPVIEW MA DA ERRORE!!!
},
prove:function(){
navigator.geolocation.getCurrentPosition(win);
function win(pos){
console.log("gps");
var el='<div>'+ pos.coords.latitude+'</div>';
el+='<div>'+ pos.coords.longitude+'</div>';
el+='<div>'+ pos.timestamp+'</div>';
$('#pagina').html(el);
var lat=pos.coords.latitude;
var lon=pos.coords.longitude;
var options={
center:new google.maps.LatLng(-34,150),
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var html=$('#pagina');
console.log(html);
var map= new google.maps.Map(document.get.Element.By.Id('pagina'),options);// ERROR HERE
};
}
});
return HomeView;
OK完美,現在不發生錯誤,但沒有任何內容在頁面上繪製。 – 2013-05-12 00:18:22
我懷疑這是一個不同的問題。也許你的地圖DIV沒有大小?嘗試查看關於主幹和Google地圖的類似問題。 – geocodezip 2013-05-12 00:23:15