小编til*_*lly的帖子

Angular 5 谷歌地图:仅显示 # 公里半径内的标记

我目前正在我的应用程序中制作地图。我为此使用了惊人的 Angular agm 包。

目标是显示带有标记的地图。这些标记来自数据库并包含纬度和经度值。我有数百个标记,我想过滤它们。我只想显示距离我所在位置(例如 5 公里)内的标记。我这个怎么办 我浏览了包的 API 文档,但没有看到解决方案。任何人都可以帮助我吗?

地图.component.html

<!-- this creates a google map on the page with the given lat/lng from -->
<!-- the component as the initial center of the map: -->
<agm-map
        [latitude]="lat"
        [longitude]="lng"
        [fullscreenControl]="true"
        [zoom]="13"
>

    <agm-marker
            *ngFor="let marker of markers"
            [latitude]="marker.latitude"
            [longitude]="marker.longitude"
            (markerClick)="doSomething($event)"

            >
        <agm-info-window [disableAutoPan]="true">
            <a routerLink="/">Go there</a>
        </agm-info-window>
    </agm-marker>
</agm-map>
Run Code Online (Sandbox Code Playgroud)

地图组件.ts

export class FindLocalsComponent implements OnInit{

    lat:number;
    lng: number;
    markers = [];

    constructor(private findLocalsService: FindLocalsService){}

    ngOnInit(){
        let token = localStorage.getItem('token'); …
Run Code Online (Sandbox Code Playgroud)

google-maps angular

1
推荐指数
1
解决办法
4575
查看次数

将元数据添加到 Stripe 客户对象

我正在使用 Stripe 设置支付系统,并且我想向客户对象添加一些元数据。我想将我的工作区 ID 添加到客户的元数据属性中。我尝试了下面的代码,但它返回以下错误:

?? Error:
 Error: Invalid val: {:_bsontype=>"ObjectID", :id=>"\\HÉ\u001E??\u000F?=??"} must be a string under 500 characters
Run Code Online (Sandbox Code Playgroud)

我已经记录了我添加到此元数据属性的工作区 ID,但它似乎只是一个常规的 mongodb ObjectId。谁能看到我做错了什么?

应该向我创建的客户添加元数据的代码

    // find the current User and use his workspace ID
    const user = await User.findOne({ _id: req.userId });
    const workspaceId = user._workspace;

    // get the payment plan
    const plan = await stripe.plans.retrieve('plan_EK1uRUJLJcDS6e');

    //   // then we create a new customer
    const customer = await stripe.customers.create({
      email,
      source,
      metadata: {
        workspace_id: workspaceId
      }
    });

    res.status(200).json({
      message: 'payment …
Run Code Online (Sandbox Code Playgroud)

javascript node.js stripe-payments

1
推荐指数
1
解决办法
1128
查看次数

无法安装 Angular Material

所以我刚刚在 angular CLI 中打开了一个新项目,我想安装 Material :

npm install --save @angular/material @angular/cdk

但它给了我以下错误:

C:\Users\TijlD\Desktop\projects\untitled46>npm install --save @angular/material @angular/cdk 
npm WARN @angular/animations@5.2.8 requires a peer of @angular/core@5.2.8 but none was installed. 
npm WARN @angular/cdk@5.2.4 requires a peer of @angular/core@^5.0.0 but none was installed. 
npm WARN @angular/cdk@5.2.4 requires a peer of @angular/common@^5.0.0 but none was installed. 
npm WARN @angular/material@5.2.4 requires a peer of @angular/core@^5.0.0 but none was installed. 
npm WARN @angular/material@5.2.4 requires a peer of @angular/common@^5.0.0 but none was installed.
Run Code Online (Sandbox Code Playgroud)

有谁知道这意味着什么以及如何摆脱它?

编辑:当我检查 Angular …

angular-material angular

0
推荐指数
1
解决办法
5501
查看次数

相同类型和相同的单词,但当被问及它们是否相同时仍然​​返回false

所以我正在使用socket.io开发一个聊天应用程序,我想决定它是我的消息还是别人的消息.我使用的两件事是我从localstorage中检索的全名,以及我发送新消息时从服务器返回的全名.有人知道为什么这两个仍然不一样,即使它们都是字符串而且它们都是由相同的单词组成的?

isItMyMsg(message){
        console.log(localStorage.getItem('fullName'));
        console.log(message.fullname);
        console.log(localStorage.getItem('fullName') === message.fullName);
        return localStorage.getItem('fullName') === message.fullName
    }
Run Code Online (Sandbox Code Playgroud)

这是我拍摄的截图结果.两个是来自本地存储和服务器对象的结果,而错误来自我评估它们是否相同时.我期待它返回TRUE,但我得到了一个FALSE

在此输入图像描述

javascript angular

0
推荐指数
1
解决办法
30
查看次数

Android studio:如何将SDK降级到33.0.0版本?

我正在尝试设置我的反应本机项目。我使用命令“npx react-native doctor”来诊断需要发生什么。到目前为止,我解决了所有问题,但我陷入了最后一个问题:

在此输入图像描述

看来我需要降级我的SDK版本。我在 Android studio 的 SDK 管理器中看到了这样做的建议,但我在那里没有看到版本 33。我应该如何解决这个问题?

在此输入图像描述

sdk android-studio react-native

0
推荐指数
1
解决办法
1863
查看次数