在开发环境中运行 ionic 2 应用程序崩溃并出现错误:
运行时错误
Uncaught (in promise): false
堆
错误:未捕获(承诺):假
在 s (http://localhost:8100/build/polyfills.js:3:4211)
在 s (http://localhost:8100/build/polyfills.js:3:4034)
在http://localhost :8100/build/polyfills.js:3:4574
在 t.invokeTask (http://localhost:8100/build/polyfills.js:3:9723)
在 Object.onInvokeTask (http://localhost:8100/build/main.js:38187:37)
在 t.invokeTask (http://localhost:8100/build/polyfills.js:3:9659)
在 e.runTask (http://localhost:8100/build/polyfills.js:3:7083)
在我 (http://localhost:8100/build/polyfills.js:3:3671)
离子框架:2.0.0-rc.5
离子原生:2.2.11
离子应用程序脚本:1.0.0
角核心:2.2.1
Angular 编译器 CLI:2.2.1
节点:6.9.4
操作系统平台:Windows 10
导航平台:Win32
用户代理:Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36
全新重新安装 -g ionic,全新 node_modules 安装。
您的系统信息:
ordova CLI:6.4.0
离子框架版本:2.0.0-rc.5
离子 CLI 版本:2.2.1
离子应用程序库版本:2.2.0
离子应用脚本版本:1.0.0
ios-deploy 版本:未安装
ios-sim 版本:未安装
操作系统:Windows 10
节点版本:v6.9.4
Xcode 版本:未安装
我在 rc4 上遇到了同样的错误,每晚构建也没有帮助。
它在 rc3 及更早版本上没有错误
我们无法从中得到任何东西,您需要遵循问题模板。 我会推荐ionic serve
来查看您在浏览器中遇到的错误。 但是是的,请分享代码和其他信息。
关闭模态后我收到此错误
看看你的模态代码,并确保在 close 事件中没有发生任何时髦的事情。
dismiss() {
this.viewCtrl.dismiss();
}
是我所做的一切
+1
使用 LoadingController 或 ActionSheetController 时出现同样的问题
在您的主页上查看您的 ondismiss 方法。 通常这种类型的事情是开发人员的问题。 如果有的话,请查看控制台中的调用堆栈。
在2017年1月16日,上午8:00 -0500,Beylkhanov达米尔[email protected] ,写道:
>
+1
同样的问题—
您收到此消息是因为您发表了评论。
直接回复本邮件,在 GitHub 上查看(https://github.com/driftyco/ionic/issues/10046#issuecomment-272856264),或者将线程静音(https://github.com/notifications/unsubscribe-auth /AEPIElAzcg8Rsqpf1HzX2q1EgPhFg-6cks5rS2nngaJpZM4LkFyw)。
@wbhob我刚刚回滚到 RC4,问题就消失了。 如果您想将其用于故障排除目的,我在 GitHub 上有一个存储库。 让我知道
你在使用 ionViewCanLeave 吗?
@manucorporat不确定您的问题是谁,但我没有使用 ionViewCanLeave。 如果有帮助,我正在使用 ionViewDidLoad()
我正在使用 ionViewCanLeave 并且我也收到此错误。 +1
我也面临这个错误。 +1
事情是这样的:
nav.push()、.pop()、viewcontroller.dismiss() 和 family 返回一个 promise,因为实际上可以拒绝转换,例如通过在 ionViewCanLeave/CanEnter 中返回 false。
确保通过执行以下操作来“抓住”承诺:
this.view.dismiss().catch(() => console.log('view was not dismissed'));
当我在 LoadingController 上“捕获” .dismiss()
时,问题就消失了。 所以最重要的是,看起来我们总是必须“抓住”我们代码中的任何dismiss() 以确保安全。 对?
你们中有人在您的应用中使用 Firebase 吗? 可能与此有关: https :
遇到同样的问题,添加.catch()
将停止显示错误。
但是,我也在dismiss()
调用中传递数据。 当OnDidDismiss
函数被执行时,它接收到的数据总是undefined
。
@brandyscarney是的,我正在使用 Firebase
就我而言,是 LoadingController 的dismiss() 导致了崩溃。
我已经把它从this.loading.dismiss();
到this.loading.dismiss().catch(() => console.log('ERROR CATCH: LoadingController dismiss'));
它在 rc3 及之前工作,但在 rc4 和 rc5 中崩溃
+1
大家好! 所以只是为了澄清这里的问题,你们只有在正确使用 firebase 时才会遇到这个问题? 你们也使用 firebase js sdk 或 AngularFire2 吗?
另外,如果您使用的是 firebase,请告诉我您在收到此错误时使用的是哪种 firebase 方法?
嘿人们,我刚刚在另一个问题中写了一些关于它的东西,看看它是否为你修复了它: https :
我遇到了几个似乎与警报控制器有关的奇怪问题。 下面的两个片段都导致相同的 Uncaught in Promise 错误,这与在解除确认后创建加载有关。
我尝试了不同的做事方式并得到相同的结果,尽管我还有另一个奇怪的问题。
// Show the confirmation
let confirm = this.alertCtrl.create({
title: 'Delete category?',
message: 'Are you sure you wish to delete this category?',
buttons: [
{ text: 'No' },
{
text: 'Yes',
handler: () => {
confirm.dismiss({ delete: true });
}
}
]
});
// Bug in RC5?
confirm.present();
confirm.onDidDismiss((doDelete: any) => {
if (doDelete.delete) {
this.doDelete(category);
}
});
handler: () => {
confirm.dismiss().then(() => {
let loading = this.loadingCtrl.create({
content: 'Deleting category...'
});
loading.present().then(() => {
在这两种情况下,它都会在调用 loading.present() 后出错。 我正在运行最新的cordova、ionic 和RC5 项目(干净)。
感谢您的示例代码@davec21 ! 我现在可以重现这个问题,并正在寻找解决方法。
@jgw96 太棒了! 很高兴你能够重现它,我正用头撞在桌子上试图弄清楚。
哈哈 我花了很多时间把头撞在桌子上(:
似乎与确认框(AlertController)的dismiss()有关。 根据一些测试,似乎只要您订阅了一个 observable(在调用dismiss 之后)它就会抛出错误。
如果我不手动调用dismiss() 并让它关闭,那么一切似乎都很好。
@davec21
如果我不手动调用dismiss() 并让它关闭,那么一切似乎都很好。
嗯,在你的情况下,你必须打开dismissOnPageChange设置(例如对于AlertController),否则它不会工作
这里有同样的错误,但使用ToastController
获取它。
当我有一个活跃的吐司并改变路线时发生。
但是,我有dismissOnPageChange: true
。
我导航的路线通过ionViewDidLoad
挂钩中的LoadingController
激活加载“事物”。
@尼克拉斯达尔
你可以试试这个对我也有用的方法
loading.dismiss().then(() => {
//navigation or other staff
});
PS设置dismissOnPageChange为false
@beylkhanovdamir
嗯,在你的情况下,你必须打开dismissOnPageChange设置(例如对于AlertController),否则它不会工作
虽然我没有改变页面。 我只是在按钮的处理程序中的对话框上调用dismiss。 如果问题不使用它,那么它可能应该命名为其他名称。 您的代码实际上就是我正在做的事情(如果您阅读了我的代码段)。
“处理程序”函数必须有一个“返回假”。
重要的是要注意处理程序返回 false。 按钮处理程序的一个特点是,当他们的按钮被点击时,它们会自动关闭警报,但是,我们需要对转换进行更多控制。 因为处理程序返回 false,所以警报不会自动解除。 相反,您现在可以完全控制警报何时完成转换,并且能够在开始新的转换之前等待警报完成转换。
来自: https :
这解决了我的问题。 XD
你好,
我在 LoadingController 上遇到了同样的问题,dismissOnP ageChange:true和 RC6
如果我使用dismiss() 方法,如果我不捕获() 错误,它仍然会失败,但无法使其与dismissOnP ageChange:true 一起使用,这实际上是我想要的,我不想每次手动关闭加载控制器。
谢谢和最好的问候。
我在 ModalController 中也看到了这一点。 不使用 Firebase(计划使用)。
let modal = this.modalCtrl.create(ModalSearchPage);
modal.onDidDismiss(data => {
console.log(data);
});
modal.present();
模态搜索页面 html
<form [formGroup]="todo" (ngSubmit)="handleOk($event)">
<ion-item>
<ion-label>Todo</ion-label>
<ion-input type="text" formControlName="title"></ion-input>
</ion-item>
<ion-item>
<ion-label>Description</ion-label>
<ion-textarea formControlName="description"></ion-textarea>
</ion-item>
<button ion-button type="submit" [disabled]="!todo.valid">Ok</button>
<button ion-button [disabled]="!todo.valid" (click)="handleCancel($event)">Cancel</button>
</form>
模型搜索页面打字稿
todo = {};
constructor(public viewCtrl: ViewController, private formBuilder: FormBuilder) {
this.todo = this.formBuilder.group({
title: ['', Validators.required],
description: [''],
});
}
handleOk() {
let data = { 'foo': 'bar' };
this.viewCtrl.dismiss(data);
}
handleCancel() {
this.viewCtrl.dismiss();
}
所以这失败了,但仅限于取消。 尝试了上述所有选项,只要触发解雇,它就会继续失败。 onDidDismiss 触发了……但是我们得到了未捕获的;
但是,当我从表单中拉出取消按钮时,我不再收到错误消息。
嘿大家,
感谢所有的评论! 我们无法再使用最终版本2.0.0
重现此问题。 如果您没有更新到最终版本,请查看更新日志以了解版本之间更新的步骤: https :
如果您仍然遇到此问题,请创建一个新问题。 确保填写提供的问题模板,包括使用我们可以使用的存储库或 plunker 进行复制的步骤。 我要结束这个问题,因为我们很难区分谁仍然遇到问题,谁没有。 谢谢! :)
同样的问题发生在 2.0.0 上。 如果我不调用this.loading.dismiss();
错误就会消失。
而且我没有使用 Firebase。
ngOnInit() {
this.bulletins = this.bulletinService.bulletins$.do(
collection => { this.hideSpinner() },
error => {
this.hideSpinner()
this._events.publish('notice', { alertCtrl: this.alertCtrl, message: "There seems to be a problem loading bulletins. Please try again later.", title: 'Error' })
}
)
this.showSpinner()
}
private showSpinner() {
this.loading = this.loadingCtrl.create({
spinner: 'dots',
content: 'Loading...'
});
this.loading.present();
}
private hideSpinner() {
if (this.loading !== undefined) {
this.loading.dismiss();
}
}
科尔多瓦 CLI:6.3.1
离子框架版本:2.0.0
离子 CLI 版本:2.2.1
离子应用程序库版本:2.2.0
离子应用脚本版本:1.0.0
ios-部署版本:1.8.5
ios-sim 版本:5.0.6
操作系统:macOS Sierra
节点版本:v6.7.0
Xcode 版本:Xcode 8.2.1 构建版本 8C1002
嘿@AdrianTeh ,你介意开一个新问题吗?
有没有为此打开一个新问题? 在 lonic 2.0.1 中使用dismissOnPageChange: true 时我仍然遇到问题
我在 Modalcontroller 上也有这个问题。
我刚刚创建了一个新的空白应用程序,并尝试将数据从我的模态传递回主视图。
我不必在dismiss() 块之后添加一个catch 块。
this.viewCtrl.dismiss(this.notiz).catch(() => {});;
@blakezeisler 2.0.1?
是的!
科尔多瓦 CLI:6.5.0
离子 CLI 版本:2.2.1
离子应用程序库版本:2.2.0
ios-deploy 版本:未安装
ios-sim 版本:未安装
操作系统:Windows 10
节点版本:v6.9.5
Xcode 版本:未安装
"ionic-angular": "2.0.1"
是的,我的意思是 2.0.1
我在 ionic 2.0.1 上遇到了这个问题
我在 ionic 2.1.0 上也遇到了这个问题。
它只发生在设备上(所以当插件工作时)。
它只会在 NavCtrl 的 push 或 pop 时发生; 它永远不会发生在 Loading 或 Alert 上,因为我已经为它们添加了 .catch() 。
从原始堆栈跟踪来看,它似乎发生在转换代码中。
Cordova CLI: 6.5.0
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Linux 4.8
Node Version: v6.10.0
Xcode version: Not installed
包.json:
"dependencies": {
"@angular/common": "2.2.1",
"@angular/compiler": "2.2.1",
"@angular/compiler-cli": "2.2.1",
"@angular/core": "2.2.1",
"@angular/forms": "2.2.1",
"@angular/http": "2.2.1",
"@angular/platform-browser": "2.2.1",
"@angular/platform-browser-dynamic": "2.2.1",
"@angular/platform-server": "2.2.1",
"@ionic/storage": "1.1.7",
"ionic-angular": "2.1.0",
"ionic-native": "2.5.1",
"ionicons": "3.0.0",
"rxjs": "5.0.0-beta.12",
"sw-toolbox": "3.4.0",
"zone.js": "0.6.26"
},
"devDependencies": {
"@ionic/app-scripts": "1.1.4",
"typescript": "2.0.9"
}
在我的项目中,我使用ionViewCanEnter()
来检查设备是否已连接到互联网。
当然,由于连接状态不是即时返回的,查询应该异步完成,这就是我在那里使用 Promises 的原因。
如果它没有连接,promise 会解析将 false 值返回给ionViewCanEnter()
。
例如
ionViewCanEnter() {
return whenConnected(this.networkService, this.appMessages, this.navCtrl);
}
上面的代码调用一个函数whenConnected
,它返回一个 Promise
该函数的代码类似于:
whenConnected() : Promise<boolean> {
return this.deviceService.ready.then(() => {
if(this.deviceService.connected){
return true;
}else{
return false;
}
});
}
注意:上面的代码并不代表获取设备连接状态的真实代码。 那个真实的有点复杂,对这个例子没有用。 我刚刚简化了它以展示我如何使用 Promises 来解决我的项目中的问题。
结论
使用此代码,当使用 false 值解决承诺时,我会收到错误消息,该值应该用于告诉导航控制器视图无法进入。
更新 1:它是 Ionic2 版本 2.1.0。
堆栈跟踪:
Error: Uncaught (in promise): false
at s (polyfills.js:3)
at polyfills.js:3
at Object.ti.reject (nav-controller-base.js:187)
at nav-controller-base.js:462
at t.invoke (polyfills.js:3)
at Object.onInvoke (ng_zone.js:236)
at t.invoke (polyfills.js:3)
at e.run (polyfills.js:3)
at polyfills.js:3
at t.invokeTask (polyfills.js:3)
希望它有助于解决这个问题。
非常感谢 !
我在下面执行此代码时收到此错误(附图)我正在使用 ionic 2 和 google maps 插件
从“@angular/core”导入{组件};
从'ionic-angular'导入{导航控制器};
进口 {
谷歌地图,
谷歌地图事件,
谷歌地图纬度,
相机位置,
谷歌地图标记选项,
谷歌地图标记
来自“离子原生”;
@零件({
选择器:'页面联系人',
templateUrl: 'contact.html'
})
导出类 ContactPage {
构造函数(公共导航控件:导航控制器){
}
ngAfterViewInit() {
this.loadMap();
}
加载映射(){
// 通过传递 HTMLElement 创建一个新地图
让元素: HTMLElement = document.getElementById('map');
let map = new GoogleMap(element);
// 创建 LatLng 对象
让离子:GoogleMapsLatLng = new GoogleMapsLatLng(43.0741904,-89.3809802);
// 创建相机位置
让位置:CameraPosition = {
目标:离子,
变焦:18,
倾斜度:30
};
// 监听 MAP_READY 事件
map.one(GoogleMapsEvent.MAP_READY).then(() => {
// 将地图的相机移动到位置
地图。移动相机(位置); // 适用于 iOS 和 Android
});
// 创建新标记
让标记选项:GoogleMapsMarkerOptions = {
位置:离子,
标题:'离子'
};
map.addMarker(markerOptions)
.then((标记:GoogleMapsMarker) => {
标记.showInfoWindow();
});
}
}
我相信只要通过将模态推入 NavController 数组而不是使用其本机.present()
函数来访问/打开模态,就会发生此错误。
尝试.dismiss()
它会失败,因为模态从来没有“_presented_”......
(我的新手意见,tho'...对 Ionic 2 和 Angular/TS 来说非常新。)
我在3.0.1 中也面临同样的问题:
let loading = loadingController.create({
spinner : 'hide',
content : `Loading...`
});
loading.present().then(() => {
//do some work
});
//Do some more work
loading.dismiss();
离子信息:
科尔多瓦 CLI:6.5.0
离子框架版本:3.0.1
离子 CLI 版本:2.2.2
离子应用程序库版本:2.2.1
离子应用脚本版本:1.3.0
ios-deploy 版本:未安装
ios-sim 版本:5.0.8
操作系统:macOS Sierra
节点版本:v6.10.1
Xcode 版本:Xcode 8.2.1 构建版本 8C1002
错误信息:
Uncaught (in promise): false
at g (polyfills.js:3)
at l (polyfills.js:3)
at l (polyfills.js:3)
at polyfills.js:3
at t.invokeTask (polyfills.js:3)
at Object.onInvokeTask (core.es5.js:4136)
at t.invokeTask (polyfills.js:3)
at n.runTask (polyfills.js:3)
at a (polyfills.js:3)
这个问题应该重新打开。
是的@chandanch @jgw96这个问题发生在我升级到 ionic 3 之后......
看起来像 LoadController 问题...
我对我的代码进行了彻底的调试,我发现在一个实例中我调用了dismiss()
两次。 如果您再次为已经解除的 LoadingController 调用dismiss()
,则会出现此错误。
在另一种情况下,如果加载甚至在创建之前就被解除。
@chandanch @jgw96
这是我的代码
**ionViewDidLoad() {
this.platform.ready()
.then(() =>
{
this.books = this.angFire.database.list('/books');
loading.dismiss();
});
let loading = this.loadingCtrl.create({content:'My message'});
loading.present();
console.log(this.angFire.database.list('/books'));
}**
我遇到错误Uncaught (in promise): false after upgrade to ionic 3.0.0
删除加载控制器后,错误消失
升级后控制器好像有问题。
请指导我解决这个问题。 我想在平台准备好之前添加加载...
@chenlititchian看起来您正在解除未创建的加载。 或者代码在这里部分共享因此它返回你未捕获的承诺异常。
this.platform.ready().then(() => {
this.books = this.angFire.database.list('/books');
// Here you are dismissing loading which is not created
loading.dismiss();
});
尝试使用ionViewDidLoad这样做。
ionViewDidLoad() {
let loader = this.loadingController.create({
spinner : 'hide',
content : `Loading...`
});
loader.present.then(() => {
this.books = this.angFire.database.list('/books');
loader.dismiss().then(() => {
console.log("Loading dismissed");
});
})
}
@chandanch是的,谢谢。 有效 ...
当我使用操作表并通过点击背景将其关闭时出现此错误(使用版本 2.0.0,但看起来不同版本的发布客户端及更高版本会出现相同的错误)。 我不知道如何向通过点击背景调用的解除添加错误处理。 任何帮助将不胜感激。
@GerryFudd你能分享代码或 plunker 吗? 我们可以有更好的画面。
我收到错误消息,我从未使用过任何 Firebase :)
我从类似页面的菜单中推送页面,如下所示:
this.NavController.push(page.component);
推送的页面有
// 20170518
ionViewWillLeave() {
//
// http://stackoverflow.com/questions/43175186/ionic-2-tabs-reset-view-when-clicking-another-tab
// enable if we want to pop/reset to upon user switching view eg.tabs
this.NavController.pop();
}
然后我切换标签,没有退出,我得到一个错误
core.es5.js:1084 ERROR Error: Uncaught (in promise): navigation stack needs at least one root page
at c (polyfills.js:3)
at Object.reject (polyfills.js:3)
at Tab.NavControllerBase._fireError (nav-controller-base.js:322)
at Tab.NavControllerBase._failed (nav-controller-base.js:310)
at nav-controller-base.js:365
at t.invoke (polyfills.js:3)
at Object.onInvoke (core.es5.js:4125)
at t.invoke (polyfills.js:3)
at r.run (polyfills.js:3)
at polyfills.js:3
离子信息
global packages:
@ionic/cli-utils : 1.0.0
Cordova CLI : 7.0.0
Ionic CLI : 3.0.0
local packages:
@ionic/app-scripts : 1.3.7
@ionic/cli-plugin-cordova : 1.0.0
@ionic/cli-plugin-ionic-angular : 1.0.0
Ionic Framework : ionic-angular 3.2.0
System:
Node : v7.2.0
OS : Windows 7
Xcode : not installed
ios-deploy : not installed
ios-sim : not installed
谢谢
打开一个模态,然后单击后退按钮。
ERROR Error: Uncaught (in promise): invalid views to insert
at c (polyfills.js:3)
at Object.reject (polyfills.js:3)
at NavControllerBase._fireError (nav-controller-base.js:322)
at NavControllerBase._failed (nav-controller-base.js:310)
at nav-controller-base.js:365
at t.invoke (polyfills.js:3)
at Object.onInvoke (core.es5.js:4128)
at t.invoke (polyfills.js:3)
at r.run (polyfills.js:3)
at polyfills.js:3
defaultErrorLogger @ core.es5.js:1084
ErrorHandler.handleError @ core.es5.js:1144
IonicErrorHandler.handleError @ ionic-error-handler.js:63
next @ core.es5.js:4757
schedulerFn @ core.es5.js:3830
SafeSubscriber.__tryOrUnsub @ Subscriber.js:238
SafeSubscriber.next @ Subscriber.js:185
Subscriber._next @ Subscriber.js:125
Subscriber.next @ Subscriber.js:89
Subject.next @ Subject.js:55
EventEmitter.emit @ core.es5.js:3816
NgZone.triggerError @ core.es5.js:4188
onHandleError @ core.es5.js:4149
t.handleError @ polyfills.js:3
r.runGuarded @ polyfills.js:3
(anonymous) @ polyfills.js:3
e.microtaskDrainDone @ polyfills.js:3
o @ polyfills.js:3
invoke @ polyfills.js:3
__信息__
global packages:
@ionic/cli-utils : 1.0.0
Ionic CLI : 3.0.0
local packages:
@ionic/app-scripts : 1.3.7
@ionic/cli-plugin-ionic-angular : 1.1.2
Ionic Framework : ionic-angular 3.2.1
System:
Node : v7.10.0
OS : macOS Sierra
Xcode : Xcode 8.3.2 Build version 8E2002
ios-deploy : 1.8.6
ios-sim : 5.0.8
简单的解决方案可能是添加setTimeout(() => {do action here ...}, 500);
动作可以改变nav.setRoot(Component Name)或nav.push(Component Name) 。
这为我消除了错误。
一切正常,但现在我不知道我更改了什么,我收到以下错误:
`this.navCtrl.push(MainPage);
错误:未捕获(承诺):要插入的视图无效
在 c (http://localhost:8100/build/polyfills.js:3:13190)
在 Object.reject (http://localhost:8100/build/polyfills.js:3:12546)
在 NavControllerBase._fireError (http://localhost:8100/build/main.js:48745:16)
在 NavControllerBase._failed (http://localhost:8100/build/main.js:48733:14)
在http://localhost :8100/build/main.js:48788:59
在 t.invoke (http://localhost:8100/build/polyfills.js:3:8971)
在 Object.onInvoke (http://localhost:8100/build/main.js:4657:37)
在 t.invoke (http://localhost:8100/build/polyfills.js:3:8911)
在 r.run (http://localhost:8100/build/polyfills.js:3:4140)
在http://localhost :8100/build/polyfills.js:3:13731
离子框架:3.5.0
离子应用程序脚本:1.3.12
角核心:4.1.3
Angular 编译器 CLI:4.1.3
节点:8.1.0
操作系统平台:Linux 4.8
导航平台:Linux x86_64
用户代理:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.86 Safari/537.36
`
谢谢如果有人有想法
@webmobiles请删除上面的帖子,然后将其作为包含更多详细信息的新帖子打开。您正在使用Ionic 3.5.0
。
在这里: https :
它有效!谢谢
你好,
我面临这个错误。
@TwalibuMsangi - 您是否导入了正确的模块? TOH 教程解释了如何在此处执行此操作: https : HttpClient
而您似乎使用较旧的Http
模块,但概念基本相同。 只有细节不同(FWIW,如果可以,我建议使用较新的HttpClient
(不确定您使用的是哪个版本的 Angular)。
嘿伙计们,我对这件事有点陌生,我想知道我是否可以得到帮助....我在使用 ngOnInIt、navParams 和 navController 在页面之间传递数据时遇到问题
嗨,我有一个问题,因为我想使用外部插件,但它不起作用,我不知道为什么,名称是 com.lampa.startapp,这是我唯一需要完成我的应用程序的想法。 请如果有人可以帮助我更快地做到这一点。 这里的错误。
Error: Uncaught (en promesa): ReferenceError: startApp no está definido ReferenceError: startApp no está definido en http: // localhost: 8100 / build / main.js: 497: 27 en t.invoke (http: / / localhost: 8100 /build/polyfills.js:3:14976) en Object.onInvoke (http:// localhost: 8100 / build / vendor.js: 5134: 33) en t.invoke (http:// localhost: 8100 / build / polyfills .js: 3: 14916) en r.run (http:// localhost: 8100 / build / polyfills.js: 3: 10143) en http:// localhost: 8100 / build / polyfills.js: 3 : 20242 en t .invokeTask (http:// localhost: 8100 / build / polyfills.js: 3: 15660) en Object.onInvokeTask (http:// localhost: 8100 / build / vendor.js: 5125: 33) en t .invokeTask (http: // localhost: 8100 / build / polyfills.js: 3: 15581) en r.runTask (http: // localhost: 8100 / build / polyfills.js: 3: 10834) en c (http: / / localhost: 8100 /build/polyfills.js:3:19752) en http:// localhost:8100 / build / polyfills.js: 3: 20273 en t.invokeTask (http:// localhost: 8100 / build / po lyfills.js: 3: 15660) en Object.onInvokeTask (http:// localhost: 8100 / build / vendor .js: 5125: 33) en t.invokeTask (http:// localhost: 8100 / build / polyfills.js: 3: 15581) en r.runTask (http:// localhost: 8100 / build / polyfills.js: 3 : 10834) en o (http: // localhost: 8100 / build / polyfills.js: 3: 7894) en e .invokeTask [como invocación] (http: // localhost: 8100 / build / polyfills.js: 3: 16823 ) en p (http: // localhost: 8100 / build / polyfills.js: 2: 27648) en HTMLImageElement.v (http://localhost:8100/build/polyfills.js:2:27893)runTask(http://localhost:8100/build/polyfills.js:3:10834)eno(http://localhost:8100/ build / polyfills.js: 3: 7894) en e.invokeTask [como invocar] ( http:// localhost: 8100 / build / polyfills.js: 3: 16823) en p (http:// localhost: 8100 / build / polyfills.js: 2: 27648) en HTMLImageElement.v (http: // localhost: 8100 / build / polyfills.js: 2: 27893)runTask (http: // localhost: 8100 / build / polyfills.js: 3: 10834 ) en o (http:// localhost: 8100 / build / polyfills.js: 3: 7894) en e.invokeTask [como invocar] ( http:// localhost: 8100 / build / polyfills.js: 3: 16823) en p (http : // 本地主机: 8100 / build / polyfills.js: 2: 27648) en HTMLImageElement.v (http: // 本地主机: 8100 / build / polyfills.js: 2: 27893)
=> 这里是代码
从“@angular/core”导入{组件};
import { IonicPage, NavController, NavParams, Platform } from 'ionic-angular';
从'../crear/crear'导入{CrearPage};
从'@ionic-native/in-app-browser'导入{InAppBrowser};
声明 var startApp: any;
@IonicPage()
@零件({
选择器:'page-utilidades',
templateUrl: 'utilidades.html',
})
导出类 UtilidadesPage {
用户:字符串;
构造函数(私有 iap:InAppBrowser,
公共导航控件:导航控制器,
公共导航参数:导航参数,
公共平台:平台){
}
Facebook(){
this.platform.ready().then(()=>{
var GoFaceb = startApp.set({
"action": "ACTION_VIEW",
"uri": "fb://facewebmodal/f?href=https://www.facebook.com/"
})。开始();
});
}
}
感谢您的问题! 此问题已被锁定,以防止发表与原始问题无关的评论。 如果使用最新版本的 Ionic 仍然存在问题,请创建一个新问题并确保模板已完整填写。
最有用的评论
事情是这样的:
nav.push()、.pop()、viewcontroller.dismiss() 和 family 返回一个 promise,因为实际上可以拒绝转换,例如通过在 ionViewCanLeave/CanEnter 中返回 false。
确保通过执行以下操作来“抓住”承诺: