小编Ada*_*dam的帖子

Ionic和Firebase - InvalidPipeArgument:管道'AsyncPipe'的'[object Object]'

我在使用Ionic 3和Firebase工作时遇到基本的CRUD待办事项列表应用程序时遇到问题.

我坚持的错误信息是:

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

我将该<ion-item *ngFor="let item of shoppingListRef$ | async">部分添加到shopping-list.html 时启动了错误消息:

购物-list.html

<ion-header>
  <ion-navbar color="primary">
    <ion-title>Shopping List</ion-title>
    <ion-buttons end>
      <button ion-button icon-only (click)="navigateToAddShoppingPage()">
        <ion-icon name="add"></ion-icon>
      </button>
    </ion-buttons>
  </ion-navbar>
</ion-header>
<ion-content padding>
  <ion-list>
    <ion-item *ngFor="let item of shoppingListRef$ | async">
      <h2>Item Name: {{item.itemName}}</h2>
      <h3>Amount: {{item.itemNumber}}</h3>
    </ion-item>
  </ion-list>
</ion-content>
Run Code Online (Sandbox Code Playgroud)

我已经尝试之间注释出代码<ion-item></ion-item>上述文件中,和去除该错误消息.但是,无法弄清楚如何解决它.

以下是涉及的一些相关文件.

购物,list.ts

import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';

import { AngularFireDatabase, FirebaseListObservable } from 'angularfire2/database';

import …
Run Code Online (Sandbox Code Playgroud)

firebase typescript ionic2 ionic3 angular

8
推荐指数
1
解决办法
4348
查看次数

如何在使用collection_select时删除重复的条目以获取唯一元素?得到错误 - 任何想法为什么?

我正在尝试做一些有点共同的事情 - 在使用时在表单上的列表中生成一系列唯一项collection_select.用户has many付款和付款belongs_to用户.我正在使用Devise,所以知道了current_user.

我可以使用以下代码在视图中成功生成包含重复的电子邮件列表:

<%= form_for(@payment) do |f| %>
.
.
.
   <%= f.collection_select :email, current_user.payment, :email, :email, {:include_blank => "Please select"} %>
Run Code Online (Sandbox Code Playgroud)

但是,我无法获得相同的电子邮件列表,以消除重复.Stackoverflow上已经多次询问过这个问题,但是我没有成功实现其他解决方案.我试过(没有运气):

<%= f.collection_select :email, current_user.payment.collect(&:email).uniq, :email, :email, {:include_blank => "Please select"} %>
<%= f.collection_select :email, current_user.payment.pluck(:email).uniq, :email, :email, {:include_blank => "Please select"} %>
Run Code Online (Sandbox Code Playgroud)

我收到错误消息undefined方法'email'为"test@example.com":字符串.任何人都可以帮助我理解(1)为什么我使用的代码不正确,以及(2)代码中的更改?

非常感谢您提供的任何帮助!

ruby forms ruby-on-rails duplicates ruby-on-rails-3

3
推荐指数
1
解决办法
1391
查看次数

在Google Apps脚本中创建所有工作表名称的列表

我的目标

我有两个电子表格SpreadSheetA和SpreadSheetB。

我试图获取SpreadSheetA中所有工作表的名称列表,并将其添加到SpreadSheetB中的活动工作表中。

到目前为止我的进度

我已经完成了代码,但是在运行它时不断收到错误消息。

相对于line,错误消息为“无法将Array转换为Object [] []” range.setValues(sheetNameArray);

这是我的代码:

function getSheetNamesAndAddToOtherSheet() {
  var spreadSheetAURL = "https://docs.google.com/spreadsheets/d/UNIQUE-ID-HERE/edit"; 
  var sheetNameArray = [];

  var spreadSheetsInA = SpreadsheetApp.openByUrl(spreadSheetAURL).getSheets();

  for (var i = 0; i < spreadSheetsInA.length; i++) {
    sheetNameArray.push(spreadSheetsInA[i].getName());
  }

  var sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
  var range = sheet.getRange(1, 1, sheetNameArray.length, 1);
  range.setValues(sheetNameArray);
}
Run Code Online (Sandbox Code Playgroud)

google-sheets google-apps-script

2
推荐指数
1
解决办法
4649
查看次数