0
underscore.js 템플릿에서 클릭 이벤트로부터 템플릿의 데이터를 가져 오는 방법이 있습니까? 예를 들면 :밑줄/백본 템플릿 이벤트
geocoder.geocode({
'address' : $(this.el).find("input[name=locationSearchText]").val()
}, function(results, status) {
if (results && status && status == 'OK') {
this.results = results;
var list =_.template("<ul><% _.each(results, function(result){ %><li><%= result.formatted_address %></li><% })%></ul>");
$el.find("#search-results").html(list);
}else{
alert("SOMETHING WENT WRONG!");
}
});
다음보기에 백본 : 과거
events: {
'click #search-results li': function(data){ 'the data of the `result` that was passed to the template in the each'}
},
당신은 단지 저를 때려 눕 힙니다 ... 나는 아직 육체를 발견하지 못했습니다. – Jack