我正在尝试为我的网络应用程序构建一个简单的搜索功能。有关于如何使用实时数据库创建它的文档。
我需要做哪些更改才能在firestore上进行这项工作?
本教程取自此处https://angularfirebase.com/lessons/autocomplete-search-with-angular4-and-firebase/
它也有一个不错的视频:)
这是如何使用实时数据库制作它:
#movies.service.ts
import { Injectable } from '@angular/core';
import { AngularFireDatabase, FirebaseListObservable } from '
angularfire2/database';
@Injectable()
export class MoviesService {
constructor(private db: AngularFireDatabase) { }
getMovies(start, end): FirebaseListObservable<any> {
return this.db.list('/movies', {
query: {
orderByChild: 'Title',
limitToFirst: 10,
startAt: start,
endAt: end
}
});
}
}
Run Code Online (Sandbox Code Playgroud)
<h1>Movie Search</h1>
<input type="text" (keydown)="search($event)" placeholder="search
movies..." class="input">
<div *ngFor="let movie of movies">
<h4>{{movie?.Title}}</h4>
<p>
{{movie?.Plot}}
</p>
</div>
<div *ngIf="movies?.length < 1"> …Run Code Online (Sandbox Code Playgroud) firebase firebase-realtime-database angularfire2 angular google-cloud-firestore
我有一个由分类树图compareTo的Account类.
当我启动树形图时,它会被排序,但是当我尝试使用此功能(为特定帐户添加资金)时,仅当我更改的值不是树形图中的第一个或最后一个时,它才有效.
这是代码.我究竟做错了什么?
public static void deposit(TreeMap<Account,MyLinkedList<Customer>> map){
boolean flag = false;
int num ;
int amount;
System.out.println("please enter account number");
num = s.nextInt();
//for(Iterator<Account> i = map.;i.hasNext())
for(Map.Entry<Account, MyLinkedList <Customer>> entry : map.entrySet()){
if(entry.getKey().getAccNumber() == num){
flag = true;
System.out.println("Please enter amount");
amount = s.nextInt();
entry.getKey().setAccBalance(entry.getKey().getAccBalance()+amount);
Account temp = entry.getKey();
MyLinkedList<Customer> tempList = entry.getValue();
map.remove(entry.getKey());
map.put(temp, tempList);
break;
}
}
if(flag == false) {
System.out.println("Account doesn't exist");
return;
}
}
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试上传文件,除非我使用允许读取、写入,否则我将未经授权。
\n\nFirebaseStorageError {code_: "storage/unauthorized", message_: "Firebase \nStorage: User does not have permission to\xe2\x80\xa62/dxbdIGnx2Qdm9MfTtG5e/if_spider-\nweb_345348.png\'.", serverResponse_: "{\xe2\x86\xb5 "error": {\xe2\x86\xb5 "code": 403,\xe2\x86\xb5 \n"message": "Pe\xe2\x80\xa6n denied. Could not perform this operation"\xe2\x86\xb5 }\xe2\x86\xb5}", name_: \n"FirebaseError"}\nRun Code Online (Sandbox Code Playgroud)\n\n我想知道 firebase 如何知道用户已登录?在我的代码中,我在尝试上传文件时不发送任何身份验证。
\n\n这是我上传文件的代码:
\n\nlet uploadTask = storageRef.child(`user_content`).child(uid).child(upload.podcast_id).child(upload.file.name).put(upload.file);\n uploadTask.on(firebase.storage.TaskEvent.STATE_CHANGED,\n (snapshot) =>{\n // upload in progress\n upload.progress = Math.floor((uploadTask.snapshot.bytesTransferred / uploadTask.snapshot.totalBytes )* 100)\n },\n (error) =>{\n // upload failed\n this.flashMessagesService.show(\'Oh snap! please try again..\', { cssClass: \'alert alert-danger\', timeout: 1500 }) \n console.log(error)\n },\n () => …Run Code Online (Sandbox Code Playgroud) firebase angularfire firebase-authentication firebase-storage angular
打字稿中的String []和[String]有什么区别?在两者之间做出选择的最佳选择是什么?
我正在实施角度谷歌地图,我从用户那里获取接送和目的地位置,并<agm-direction>在角度谷歌地图中显示方向。我已经在地图上显示了起点和目的地的标记,但在实施之后<agm-direction>它开始显示默认标记“A”和“B”。我想从地图中删除这些标记,或者将默认图标从“A”和“B”更改为其他图标。
<agm-map id="map" [latitude]='lat' [longitude]='lng' (mapReady)="addMarker()" [zoom]='zoom'>
<agm-marker [iconUrl]="curicon" [latitude]="lat" [longitude]="lng"></agm-marker>
<agm-marker [iconUrl]="desticon" [latitude]="latitude" [longitude]="longitude"></agm-marker>
<agm-direction [origin]="origin" [destination]="destination" >
</agm-direction>
</agm-map>
ts code :
public origin: {lat :30.7224576,lng:76.6984192};
public destination: {lat:30.7134158,lng:76.71059969999999};
public curicon="http://www.google.com/intl/en_us/mapfiles/ms/micons/blue-dot.png";
public desticon="http://www.google.com/intl/en_us/mapfiles/ms/micons/red-dot.png";
Run Code Online (Sandbox Code Playgroud) 我有一个在 Node.js 服务器上使用 Google Drive API 将文件上传到 Google Drive 的流程。一切正常,文件已上传到我的谷歌驱动器内的特定文件夹。我创建了一个包含所有功能的文件 google-drive.js
const fs = require('fs');
const readline = require('readline');
const {google} = require('googleapis');
// If modifying these scopes, delete token.json.
const SCOPES = ['https://www.googleapis.com/auth/drive'];
// The file token.json stores the user's access and refresh tokens, and is
// created automatically when the authorization flow completes for the first
// time.
const TOKEN_PATH = 'token.json';
function readFile(filePath) {
fs.readFile('./server/drive/credentials.json', (err, content) => {
if (err) return console.log('Error loading client secret file:', …Run Code Online (Sandbox Code Playgroud) 我正在使用Angular5开发一个Web应用程序。我有一个包含一些“帖子”的数据库,每个帖子都包含一个我从4chan API获取的图像URL。URL是合法的(如果我手动检查它可以工作),但是在Web浏览器中调试时,控制台中禁止使用403。另一个奇怪的事情是,如果我手动转到URL,然后刷新我的应用程序,则图像会突然显示。
示例网址: "http://i.4cdn.org/lgbt/1521711096067.jpg"
angular ×4
firebase ×2
javascript ×2
agm-map ×1
angular7 ×1
angularfire ×1
angularfire2 ×1
arrays ×1
google-maps ×1
html ×1
image ×1
java ×1
node.js ×1
oauth-2.0 ×1
sorting ×1
treemap ×1
typescript ×1
url ×1