【问题标题】:How to check an input using asynchronous data如何使用异步数据检查输入
【发布时间】:2018-09-21 09:25:14
【问题描述】:

我正在使用 angularfire2 为我的 ionic 应用程序实现 firebase。我需要根据实时数据库检查或取消选中输入。这是我的实现。

<input type="checkbox" name="onoffswitch" [checked]={{(booked | async)?.booked}} >

这给了我 HTML 错误。

【问题讨论】:

    标签: firebase asynchronous firebase-realtime-database ionic3 angularfire2


    【解决方案1】:

    因为[checked] 需要一个不需要括在括号中的变量。

    你应该能够做到以下几点;

    <input type="checkbox" name="onoffswitch" [checked]="(booked | async)?.booked">
    

    <input type="checkbox" name="onoffswitch" checked="{{ (booked | async)?.booked }}">
    

    阅读Angular Documentation 中的模板语法。它更详细地解释了属性绑定。

    【讨论】:

      猜你喜欢
      • 2016-03-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-05-05
      • 2016-01-18
      • 1970-01-01
      • 1970-01-01
      • 2020-03-05
      相关资源
      最近更新 更多