File

src/app/materials/amap/amap.component.ts

Implements

OnInit

Metadata

selector app-amap
styleUrls ./amap.component.scss
templateUrl ./amap.component.html

Index

Properties
Methods

Constructor

constructor()

Methods

ngOnInit
ngOnInit()
Returns : void
view
view()
Returns : void

Properties

isView
Type : boolean
Default value : false
lat
Type : number
Default value : 121.47
lng
Type : number
Default value : 31.23
import { Component, OnInit } from '@angular/core';

@Component({
  selector: 'app-amap',
  templateUrl: './amap.component.html',
  styleUrls: ['./amap.component.scss']
})
export class AmapComponent implements OnInit {

  lat: number = 121.47;
  lng: number = 31.23;

  isView: boolean = false;

  constructor() { }

  ngOnInit() {
  }

  view() {
    this.isView = true;
  }

}
<mat-card>
  <mat-card-title>高德地图</mat-card-title>
  <mat-card-content>
    <stbui-amap></stbui-amap>
  </mat-card-content>
</mat-card>

<mat-card>
  <mat-card-title>指定经纬度</mat-card-title>
  <mat-card-content>
    <mat-form-field>
      <input matInput placeholder="经度" [(ngModel)]="lat">
    </mat-form-field>

    <mat-form-field>
      <input matInput placeholder="纬度" [(ngModel)]="lng">
    </mat-form-field>

    <button mat-raised-button color="primary" (click)="view()">查看</button>

    <stbui-amap *ngIf="isView" [lat]="lat" [lng]="lng"></stbui-amap>
  </mat-card-content>
</mat-card>

./amap.component.scss

:host {
  display: block;
}

mat-card {
  margin: 20px;
}
Legend
Html element
Component
Html element with directive

result-matching ""

    No results matching ""