javascript - 如何使用 Sequelize 显示来自 Google map 地址的内容?

标签 javascript angularjs google-maps sequelize.js ng-map

我找了几个星期的信息。
首先,我使用 AngularJS 1.6 ngMap 模块。

这就是我正在做的事情:

  • 我在主页中使用了一个搜索框(带有 ngMap 自动完成功能):
    import htmlTemplate from './searchBox.html';
    
    export default {
    
      template: htmlTemplate,
    
      require: {
        parent: '^home'
      },
    
      controller: function controller(MapsService, $log) {
        'ngInject';
    
        const self = this;
    
        this.$onInit = () => {
          $log.info('searchBox component init');
          MapsService.loadGoogleApi().then(() => {
            this.loaded = true;
            this.onPlaceChanged = function onPlaceChanged() {
              const place = this.getPlace();
              if (place.geometry) {
                self.activity.lat = place.geometry.location.lat();
                self.activity.lng = place.geometry.location.lng();
              }
            };
          });
    
  • 另外,我正在使用一个显示事件的组件。
    当我通过表单创建事件时,我填写了 地址字段 它使用自动完成。
    <div class="input-field col s12">
        <i class="material-icons prefix">location_on</i>
              <input ng-if="$ctrl.loaded" places-auto-complete ng-model="$ctrl.activity.address" id="icon_prefix" type="text" on-place-changed="$ctrl.onPlaceChanged()"
                class="validate">
              <label for="icon_prefix">{{'ANNOUNCE.ADDRESS' | translate}}
        </label>
    

  • 我指定了地址 转换为纬度/经度 .
    MapsService.loadGoogleApi().then(() => {
        this.loaded = true;
        this.onPlaceChanged = function onPlaceChanged() {
          const place = this.getPlace();
          if (place.geometry) {
            self.activity.lat = place.geometry.location.lat();
            self.activity.lng = place.geometry.location.lng();
          }
        };
      });
    

  • 我的问题是:

    如何通过使我的搜索框地址和我的表单地址重合来显示事件(按城市)?

    非常感谢 !

    最佳答案

    所以...我找到了答案。
    有必要在数据库中添加一个存储过程并创建一个允许取回数据的函数。

    关于javascript - 如何使用 Sequelize 显示来自 Google map 地址的内容?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48270597/

    相关文章:

    angularjs - 如何在 AngularJS 指令中访问全局 js 变量

    google-maps - 为什么 Google 地理编码 API 可以在没有 key 的情况下工作?

    php - 在 PHP 上正确解码双编码 UTF-8

    javascript - 如何在 react js中保留浏览器后退按钮上应用的过滤器

    javascript - Angular Directive(指令)不适用于子元素

    javascript - 在没有 onclick 功能的 ng-repeat 中刷新列表

    带有字幕功能的 JavaScript 幻灯片放映

    javascript - 调用一个 JS 模块中的方法并向另一个 JS 模块返回数据

    android - 如何处理集群中的大量 ClusterItems - Android GoogleMaps V2

    javascript - 如何使用 google.maps.Map 结果渲染谷歌地图