【问题标题】:How do you display error message from firebase into an angular2 application如何将来自 firebase 的错误消息显示到 angular2 应用程序中
【发布时间】:2017-02-25 01:11:56
【问题描述】:

如何在我的应用程序中显示错误消息,而不是在控制台中打印。 这是下面的示例(在控制台中打印)

promise.catch(e => console.log(e.message));

我希望能够在我的 html 中打印以上内容。

有什么帮助吗?

【问题讨论】:

  • 给变量赋值不起作用?
  • 我已经尝试了很多次,但它不仅仅是工作。你还有什么想法吗?
  • 请说明到目前为止您尝试了什么?
  • @SydneyLoteria 为什么要删除它?
  • 这是我尝试过的:promise.catch(function(error){ this.one = error.message; });

标签: angular firebase-realtime-database firebase-authentication firebase-security angular2-forms


【解决方案1】:

你可以使用AarrowFunction如图()=>

promise.catch((error)=>{ this.one = error.message; });

【讨论】:

    猜你喜欢
    • 2017-10-17
    • 1970-01-01
    • 1970-01-01
    • 2012-05-05
    • 2019-02-20
    • 2021-02-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多