<bdo id='Y1l0T'></bdo><ul id='Y1l0T'></ul>
  1. <legend id='Y1l0T'><style id='Y1l0T'><dir id='Y1l0T'><q id='Y1l0T'></q></dir></style></legend>
  2. <tfoot id='Y1l0T'></tfoot>

      <small id='Y1l0T'></small><noframes id='Y1l0T'>

    1. <i id='Y1l0T'><tr id='Y1l0T'><dt id='Y1l0T'><q id='Y1l0T'><span id='Y1l0T'><b id='Y1l0T'><form id='Y1l0T'><ins id='Y1l0T'></ins><ul id='Y1l0T'></ul><sub id='Y1l0T'></sub></form><legend id='Y1l0T'></legend><bdo id='Y1l0T'><pre id='Y1l0T'><center id='Y1l0T'></center></pre></bdo></b><th id='Y1l0T'></th></span></q></dt></tr></i><div id='Y1l0T'><tfoot id='Y1l0T'></tfoot><dl id='Y1l0T'><fieldset id='Y1l0T'></fieldset></dl></div>

      ionic3 - 错误错误:未捕获(承诺):错误:InvalidPipeArgument:'[object Ob

      ionic3 - ERROR Error: Uncaught (in promise): Error: InvalidPipeArgument: #39;[object Object]#39; for pipe #39;AsyncPipe#39;(ionic3 - 错误错误:未捕获(承诺):错误:InvalidPipeArgument:[object Object] for pipeAsyncPipe) - IT屋-程序员软件开发技术

              <small id='pNoUQ'></small><noframes id='pNoUQ'>

            • <tfoot id='pNoUQ'></tfoot>
              <i id='pNoUQ'><tr id='pNoUQ'><dt id='pNoUQ'><q id='pNoUQ'><span id='pNoUQ'><b id='pNoUQ'><form id='pNoUQ'><ins id='pNoUQ'></ins><ul id='pNoUQ'></ul><sub id='pNoUQ'></sub></form><legend id='pNoUQ'></legend><bdo id='pNoUQ'><pre id='pNoUQ'><center id='pNoUQ'></center></pre></bdo></b><th id='pNoUQ'></th></span></q></dt></tr></i><div id='pNoUQ'><tfoot id='pNoUQ'></tfoot><dl id='pNoUQ'><fieldset id='pNoUQ'></fieldset></dl></div>
                <tbody id='pNoUQ'></tbody>
                <bdo id='pNoUQ'></bdo><ul id='pNoUQ'></ul>
                <legend id='pNoUQ'><style id='pNoUQ'><dir id='pNoUQ'><q id='pNoUQ'></q></dir></style></legend>

                本文介绍了ionic3 - 错误错误:未捕获(承诺):错误:InvalidPipeArgument:'[object Object]' for pipe'AsyncPipe'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                在测试评论功能已经工作之后,我用 ionic3 用 firebase 做了一个新闻评论功能,但是当我想在我的项目中显示评论时出现错误.

                I did a news comment function by ionic3 with firebase, after testing comment function working already, but when I want the comment showing in my project error coming out.

                错误错误:未捕获(承诺):错误:InvalidPipeArgument:管道AsyncPipe"的[object Object]"

                ERROR Error: Uncaught (in promise): Error: InvalidPipeArgument: '[object Object]' for pipe 'AsyncPipe'

                我的项目遵循此教程.

                html 文件

                <ion-list>
                  <ion-item-group *ngFor="let contact of contactsList | async">
                    <ion-item>
                      {{contact.$value}}
                    </ion-item>
                  </ion-item-group>
                </ion-list>
                
                    <ion-list>
                        <ion-row>
                            <ion-col col-6>
                                <ion-input type="text" [(ngModel)]="Contact" placeholder="写评论..."></ion-input>
                            </ion-col>
                            <ion-col>
                                <button ion-button color="primary" (click)="addContact()">发布</button>
                            </ion-col>      
                        </ion-row>
                    </ion-list>
                

                ts 文件

                 import { AngularFireList } from 'angularfire2/database';
                
                 export class NewsDetailPage {
                  new: any;
                  contactsList:AngularFireList<any>;
                  Contact = '';
                
                  constructor(public navCtrl: NavController, public navParams: NavParams,
                    private qq: QQSDK, private socialSharing: SocialSharing,
                    public firebaseService:FirebaseServiceProvider,public alertCtrl: AlertController
                    // private photoViewer: PhotoViewer
                  ) {
                    this.new = navParams.get('new');
                    this.contactsList = this.firebaseService.getContactsList();
                  }
                
                  addContact() {
                    this.firebaseService.addContact(this.Contact);
                
                    const alert = this.alertCtrl.create({
                      title: '评论成功!',
                      //subTitle: 'Your friend, Obi wan Kenobi, just accepted your friend request!',
                      buttons: ['确认']
                    });
                }
                

                更新:

                  getContactsList() {
                    return this.angularfiredb.list('/contactsList/');
                  }
                

                推荐答案

                你需要先将 AngularFireList 转换为 Observable:

                You need to first convert the AngularFireList to an Observable :

                contactsList: Observable<any[]>;
                

                在你的构造函数中,你需要调用 valueChanges() .这是从 AngularFire2 版本 5 开始的.

                And in your constructor, you need to call valueChanges() on it. This is since AngularFire2 Version 5.

                this.contactsList = this.firebaseService.getContactsList().valueChanges();
                

                这将通过不带 $key$value 的 observable 返回数据.为了在 html 中打印,请使用

                This will return the data through the observable without $key or $value. In order to print in html,use

                  {{contact}}
                

                而不是

                  {{contact.$value}}
                

                这篇关于ionic3 - 错误错误:未捕获(承诺):错误:InvalidPipeArgument:'[object Object]' for pipe'AsyncPipe'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                Fetch multiple links inside foreach loop(在 foreach 循环中获取多个链接)
                Backbone Fetch Request is OPTIONS method(Backbone Fetch Request 是 OPTIONS 方法)
                Fetch API leaks memory in Chrome(Fetch API 在 Chrome 中泄漏内存)
                How can I download and save a file using the Fetch API? (Node.js)(如何使用 Fetch API 下载和保存文件?(Node.js))
                Send blob data to node using fetch, multer, express(使用 fetch、multer、express 将 blob 数据发送到节点)
                Sending a custom User-Agent string along with my headers (fetch)(发送自定义用户代理字符串以及我的标头(获取))

                  <tbody id='NIlrW'></tbody>
                <i id='NIlrW'><tr id='NIlrW'><dt id='NIlrW'><q id='NIlrW'><span id='NIlrW'><b id='NIlrW'><form id='NIlrW'><ins id='NIlrW'></ins><ul id='NIlrW'></ul><sub id='NIlrW'></sub></form><legend id='NIlrW'></legend><bdo id='NIlrW'><pre id='NIlrW'><center id='NIlrW'></center></pre></bdo></b><th id='NIlrW'></th></span></q></dt></tr></i><div id='NIlrW'><tfoot id='NIlrW'></tfoot><dl id='NIlrW'><fieldset id='NIlrW'></fieldset></dl></div>
              • <legend id='NIlrW'><style id='NIlrW'><dir id='NIlrW'><q id='NIlrW'></q></dir></style></legend>
                  <bdo id='NIlrW'></bdo><ul id='NIlrW'></ul>

                      <tfoot id='NIlrW'></tfoot>

                      • <small id='NIlrW'></small><noframes id='NIlrW'>