如何在javascript中连接两个字符串变量

时间:2017-07-21 15:23:36

标签: javascript google-maps model-view-controller

我想在谷歌地图的标记标题中组合显示两个变量数据。 在标记标题中我想显示记录的id和时间。但是我联系了这行标题:@ Model.AssetTrackers [0] .deviceid + markerSettings.time。中显示错误的内容。错误是13ef是未定义的。 13ef是deviceid。

代码

 function addMarker(markerSettings) {
        if (!insidePolygon(markerSettings)) {
            //alert(markerSettings.deviceId + " is out of fence");
            deviceIds.push(markerSettings.deviceId);
            times.push(markerSettings.trackTime);
            var deviceId = $.grep(deviceIds, function( a ) {
                return a === markerSettings.deviceId;
            })

            var trackTime = $.grep(times, function (b) {
                return b === markerSettings.time;
            })
            if(deviceId.length == 1){
                $.notify(markerSettings.deviceId + " is out of fence", {
                    className: 'error',
                    clickToHide: true,
                    autoHide: false,
                    globalPosition: 'top right'
                });
            }
            var marker = new google.maps.Marker({
                position: markerSettings,
                map: map,
            title:@Model.AssetTrackers[0].deviceid +  markerSettings.time,//error getting
                label:labels[labelIndex++ % labels.length],
                icon : "https://developers.google.com/maps/documentation/javascript/examples/full/images/beachflag.png"
            });
        }

0 个答案:

没有答案