首页 > 解决方案 > 我想制作对象并将其绑定到打字稿中的html

问题描述

我想制作对象并将其绑定到打字稿中的 html 文件中。这段代码是 javascript 格式,所以我应该怎么做才能创建一个对象并将其绑定到 html 文件中。

<map>
<div>
    <div #map style="position:relative;width:100%;min-width:290px;height:600px;"></div>
</div>
<div>
    <button (click)="searchAddress()">Search</button>
</div>
</map>



showPopup(e): void {
//Get the properties and coordinates of the first shape that the event occurred on.

var p = e.shapes[0].getProperties();
var position = e.shapes[0].getCoordinates();

//Create HTML from properties of the selected result.
var html = `
  <div style="padding:5px">
    <div><b>${p.poi.name}</b></div>
    <div>${p.address.freeformAddress}</div>
    <div>${position[1]}, ${position[0]}</div>
  </div>`;

//Update the content and position of the popup.
this.popup.setPopupOptions({
    content: html,
    position: position
});.

标签: htmlcssangulartypescriptangular-material

解决方案


推荐阅读