2017-08-30 61 views
0

我使用AngularFire2在我的html页面上实时显示数据,它通过async连接。查看运行功能

<ion-item *ngFor="let item of Reminders | async"> 
    <!-- display below --> 
    <ion-label>{{item.name}}</ion-label> 
</ion-item> 

在打字稿方面:

import {FirebaseListObservable, AngularFireDatabase} from 'angularfire2/database'; 
Reminders: FirebaseListObservable<any[]>; 
//Call database 
this.Reminders = db.list('/xxx/'); 

一切都很正常,我现在的问题是对事物的看法方面,{{item.name}}实际上是加密的,所以我要调用一个函数或找到一种方法,解密之前显示,因为它使用async我不知道是否有可能作为日志this.Reminders只给了我一个Observable,有没有办法让我做到这一点?

回答

0

在你的控制器简单地定义一个函数来解密您的数据:

{{decrypt(item.name)}} 

当你Reminders得到加载和你*ngFor踢:

​​

然后你就可以在你的模板中使用它中,item.name将传递到您的解密函数并显示解密的文本。