我是新來的Ionic 2和周圍的一切。我嘗試設置我的第一個移動應用程序:觸摸按鈕我會打開原生導航(例如Google Maps for Android)。我已經安裝了launchnavigator
插件:LaunchNavigator Ionic2插件未安裝
ionic plugin add uk.co.workingedge.phonegap.plugin.launchnavigator
和cremony.ts頁面內:
import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import { LaunchNavigator, LaunchNavigatorOptions } from 'ionic-native';
@Component({
selector: 'page-ceremony',
templateUrl: 'ceremony.html'
})
export class Ceremony {
constructor(public navCtrl: NavController) {
}
navigate() {
let options: LaunchNavigatorOptions = {
start: ""
};
LaunchNavigator.navigate("London, UK", options)
.then(
success => alert('Launched navigator'),
error => alert('Error launching navigator: ' + error)
);
}
}
使構建npm run build
並將其上傳到IonicView與ionic upload
。 我已經盡了一切建議在this link,但運氣不同。
但是當我點擊離子視圖中的按鈕(一個簡單的<button ion-button (click)="navigate()">Navigate</button>
)在Ionic View中出錯時說:Error launghing navigator: plugin_not_installed
。
我檢查過該項目,plugins
目錄包含uk.co.workingedge.phonegap.plugin.launchnavigatorlooks
目錄。所以我看看package.json
和3210,並且我在widget
根中添加了 中的值uk.co.workingedge.phonegap.plugin.launchnavigator
和標記<plugin name="uk.co.workingedge.phonegap.plugin.launchnavigator" spec="~3.2.1" />
。 npm run build
,ionic upload
但沒有改變。
我的錯誤在哪裏?
嘗試在'this.platform.ready()。內調用' –
它看起來像Javascript,而我的代碼庫位於Typescript中。有一個wya將它轉換爲TS? –
typescript是javascript的超集.. –