Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49254

Airmap: ReferenceError: Airmap is not defined

$
0
0

@OverArizona wrote:

Hello,

How I can solve my problem with Airmap is not defined? Everything that I can find on the World-Wide-Webs fails ;( What am I missing? Any help is appreciated. Thnx.

The Airmap.ts:

import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';

declare var Airmap: any;

@IonicPage()
@Component({
	selector: 'page-airmap',
	templateUrl: 'airmap.html',
})
export class AirmapPage {

	constructor(public navCtrl: NavController, public navParams: NavParams) {
		// platform.ready().then(() => {
			// this.loadMap();
		// });
	}

	ionViewDidLoad() {
		console.log('ionViewDidLoad AirmapPage');
	}

	ionViewWillEnter() {
		this.loadMap();
	}

	loadMap() {
		let config = {
			"airmap": {"api_key": '<AIRMAPKEY>'},
			"auth0": {"client_id": '<AIRMAPCLIENT>',"callback_url": null},
			"mapbox": {"access_token": '<MAPBOXTOKEN>'}
		};

		let map = new Airmap.Map(config, {
			container: 'airspaceMap',
			theme: 'standard',
			center: [33.238634, -111.7078655],
			zoom: '10',
			layers: ['airports_commercial', 'national_parks', 'tfrs', 'wildfires'],
			/* refer to the docs for a comprehensive list of options */
		});

		map.on('click', function(click) {
			map.move(click.lngLat.lat, click.lngLat.lng);
		});
	}
}

index.html:

  . . .
  <ion-app></ion-app>

  <!--Airmap-->
  <script src="assets/js/airmap.map.min.js"></script>

  <!-- The polyfills js is generated during the build process -->
  <script src="build/polyfills.js"></script>
  . . .

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49254

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>