0

我正在开发一个 AngularJs 应用程序,并且我在其中使用 ammaps。我有一张表,其中列出了所有员工,每行有四列:{ ID、姓名、位置和描述}。我正在使用该位置在地图上显示每个员工的位置。现在,当我单击表格中的行时,应该突出显示地图上的点。谁能让我知道如何实现这一目标。

<div class="customTable">
    <table class="table">
        <thead class="active">
            <tr>
                <th>Employee ID</th>
                <th>Name</th>
                <th>Location</th>
                <th>Description</th>
            </tr>
        </thead>
        <tbody ng-repeat="emp in enployees| filter:filterCriteria">
            <tr>
                <td>{{emp.empId}}</td>
                <td>{{emp.empname}}</td>
                <td>{{emp.location}}</td>
                <td>{{emp.description}}</td>    
            </tr>
        </tbody>
    </table>
</div>

控制器中的代码:

$http.get("http://localhost:9081/employee/details/map")
            .then(response => {
                /*
                 Create two circles for each map point.
                 The top image has a thick white outline.
                 The bottom image is larger with no outline.
                 The effect is like a "bull's eye", so there's a circle with a colored ring, white ring, and colored center.
                 This is easier to stop on the map than a solid circle.
                 */
                const images = response.data.map(point => {
                    return {
                        latitude: point.latitude,
                        longitude: point.longitude,
                        title: point.name,
                        idBase: point.id,
                        id: `${point.id}.1`,
                        selectable: true
                    }
                });


                map.addListener("clickMapObject", function (event) {
                    console.log(event.mapObject.title);
                    alert(event.mapObject.title);
                });

                map.dataProvider.images = images;
                map.validateData();
            });
4

0 回答 0