I am currently working on developing an Android app using Ionic 2. I have declared a variable in the script tag within my index.html file. This constant value is intended to be used in both Ionic 2 pages and providers code. Below, I have included the snippet of code. Thank you in advance.
index.html
<html lang="en">
<head>
<title>Ionic</title>
<meta charset="UTF-8">
<link ios-href="build/css/app.ios.css" rel="stylesheet">
<link md-href="build/css/app.md.css" rel="stylesheet">
<link wp-href="build/css/app.wp.css" rel="stylesheet">
</head>
<body>
<ion-app></ion-app>
<!-- cordova.js required for cordova apps -->
<script src="cordova.js"></script>
<script src="build/js/es6-shim.min.js"></script>
<!-- Zone.js and Reflect-metadata -->
<script src="build/js/Reflect.js"></script>
<script src="build/js/zone.js"></script>
<!-- the bundle which is built from the app's source code -->
<script src="build/js/app.bundle.js"></script>
<script type="text/javascript">
BASE_APP_URL="www.google.com";
</script>
</body>
</html>
item-details.ts
import {Component} from '@angular/core';
import {NavController, NavParams} from 'ionic-angular';
@Component({
templateUrl: 'build/pages/item-details/item-details.html'
})
export class ItemDetailsPage {
selectedItem: any;
constructor(public navCtrl: NavController, navParams: NavParams) {
this.selectedItem = navParams.get('item');
console.log(BASE_APP_URL);
<!---it gives an error that name
Error TS2304: Cannot find name 'BASE_APP_URL'. -->
}
}