我的方法从Firebase返回一个Observable数组.我决定过滤客户端而不是服务器中的数据.我的问题是,如果属性"atte = true",我只想获取数据.任何帮助或其他方法都非常感谢.非常感谢你.
下面的方法从firebase实时数据库中获取数据
userEvents: Observable<any[]>;
getUserEvents(uid: string) {
this.userEvents = this.db.list(this.basePatheventsSaved, ref=>
ref.orderByChild('uid').equalTo(uid)).snapshotChanges().map((actions) => {
return actions.map((a) => {
const data = a.payload.val();
const $key = a.payload.key;
return { $key, ...data };
});
});
return this.userEvents;
}
Run Code Online (Sandbox Code Playgroud)
下面的代码用于确定templaTe中使用的数据:
userEvents: Observable<any[]>;
constructor(public auth: AuthService, private upSvc: FilesServiceService) {
this.userEvents = this.upSvc.getUserEvents(this.auth.currentUserId);
}
Run Code Online (Sandbox Code Playgroud) observable firebase typescript angularfire firebase-realtime-database
我的目标是确保用户在提交表单之前输入有效数据(无数字)并且输入字段不应为空。帮助!!!
ts文件代码如下:
import { Routes, RouterModule, Router, ActivatedRoute } from "@angular/router";
import { Component, NgModule, Input, Output, EventEmitter } from '@angular/core';
import { Environments } from './Environment-class';
import { FormBuilder, FormsModule, ReactiveFormsModule, FormGroup, FormControl, Validators } from '@angular/forms';
@Component({
selector: 'addenvironment-form',
templateUrl: './add-environment-form.component.html'
})
export class AddEnvironmentComponent {
@Output() EnvironementCreated = new EventEmitter<Environments>();
createNewEnv(EnvironmentNames: string) {
this.EnvironementCreated.emit(new Environments(EnvironmentNames));
}
Run Code Online (Sandbox Code Playgroud)
}
和 HTML 文件
<br />
<div class="card">
<h4 class="card-header">Add a New Environment</h4>
<div class="card-body mx-auto ">
<form class="form-inline ">
<div …Run Code Online (Sandbox Code Playgroud) 我正在创建一个存储到arraylist(项目键,数量和项目的价格)的篮子.如何仅更新数量而不是使用相同的Item键创建另一行.以下是该程序的结果.
Java Book 1 £48.90
Samsung Galaxy S7 1 £639.50
Speakers 3 £59.80
Java Book 2 £48.90
Samsung Galaxy S7 2 £639.50
Run Code Online (Sandbox Code Playgroud)
//////////////////////////////////////////////////
private void ItemsBasket(String name, int qty, String key) throws HeadlessException {
if (name == null) {
JOptionPane.showMessageDialog(null, "Please Selecet a key");
String imageFileName = "./images/" + key + ".png";
File imageFile = new File(imageFileName);
if (!imageFile.exists()) {
imageFileName = "./images/empty.png";
}
} else if (qty <= StockData.getQuantity(key)) {
arList.add(StockData.getName(key) + "\t\t " + qty + " " …Run Code Online (Sandbox Code Playgroud) typescript ×2
angular ×1
angularfire ×1
arraylist ×1
firebase ×1
forms ×1
html ×1
java ×1
javascript ×1
observable ×1