我正在尝试以下firebase deploy
命令,我收到以下错误:
错误:授权失败.此帐户缺少项目ID项目的以下必需权限:
cloudfunctions.functions.create
cloudfunctions.functions.delete
cloudfunctions.functions.get
cloudfunctions.functions.list
cloudfunctions.functions.update
cloudfunctions.operations.get
firebase.projects.get
firebasehosting.sites.update
Run Code Online (Sandbox Code Playgroud)
我有所有的访问权限.我正在使用角6.
我应该提一下,这个项目在Firebase的前一个项目中正常运行.我创建了一个新的,我想将前一个的内容迁移到这个新的内容,并且问题就出现了.
我还应该提到在我与其他用户登录之前.
有任何想法吗?
如何在Angular上传之前预览我选择的多个图像?
我已经设法做到但只有一张图片,即使我选择了几张,只有一张能识别我.我认为使用*ngFor
是一个很好的选择,但我不知道如何提高它.有任何想法吗?
myComponent.html
<img *ngIf="url" [src]="url" class="rounded mb-3" width="180">
<input type="file" multiple (change)="detectFiles($event)">
Run Code Online (Sandbox Code Playgroud)
myComponent.ts
detectFiles(event) {
this.selectedFiles = event.target.files;
if (event.target.files && event.target.files[0]) {
var reader = new FileReader();
reader.onload = (event: any) => {
this.url = event.target.result;
}
reader.readAsDataURL(event.target.files[0]);
}
}
Run Code Online (Sandbox Code Playgroud) 如何使用 ngFor 获取项目总数?
*ngFor="let aviso of avisosTest | async; let i = index"
Run Code Online (Sandbox Code Playgroud)
我正在使用带有 Observable 的 Firebase 的 Firestore:
avisosTest: Observable<Aviso[]>;
Run Code Online (Sandbox Code Playgroud)
我试过这个,但没有用
{{ avisosTest.length }}
{{ avisosTest?.length }}
Run Code Online (Sandbox Code Playgroud) 有人能告诉我为什么当我单击Crear Proyecto
按钮时,模态打开然后立即关闭吗?
https://stackblitz.com/edit/angular-gsgmu8?embed=1&file=app/portafolio/portafolio.component.ts
我在模态中插入组件的内容。我正在使用 Angular 材料。
portafolio.component.ts
import { CrearProyectoComponent } from '../crear-proyecto/crear-proyecto.component';
import { MatDialog } from '@angular/material';
constructor(public dialog: MatDialog) { }
openAddModal() {
let dialogRef = this.dialog.open(CrearProyectoComponent, {
width: '600px'
});
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用角度管道,具体如下:{{fechaCreacion | date: 'medium'}}
我得到以下错误:Unable to convert Timestamp (seconds = 1528157765, nanoseconds = 878000000)" into a date 'for pipe' DatePipe'
当我离开时,{{ fechaCreacion }}
它显示以下内容:
我怎么解决这个问题?
我正在使用:
Angular 6
"angularfire2":"^ 5.0.0-rc.10"
"firebase":"^ 5.0.4",
component.ts
aviso: any = {};
id;
titulo;
descripcion;
fechaCreacion;
categoria;
constructor( private fs: FirebaseService, private activatedRoute: ActivatedRoute) { }
ngOnInit() {
this.id = this.activatedRoute.snapshot.params['id'];
this.fs.getAvisoObject(this.id).valueChanges().forEach(aviso => {
this.titulo= aviso.titulo,
this.descripcion = aviso.descripcion,
this.fechaCreacion = aviso.fechaCreacion,
this.categoria = aviso.categoria
});
}
Run Code Online (Sandbox Code Playgroud)
component.html
<mat-card class="px-3 px-md-5 …
Run Code Online (Sandbox Code Playgroud) 当我尝试在我的应用程序中获取它时,例如:
<p>{{ fechaInicio | date }}</p>
得到以下错误:
错误错误:InvalidPipeArgument:“无法将“时间戳(秒=1553230800,纳秒=0)”转换为管道“DatePipe”的日期
然后我看到添加toDate()
据说可以解决问题:
<p>{{ fechaInicio.toDate() | date }}</p>
这正确显示了日期,但是我收到以下错误:
错误类型错误:无法读取未定义的属性“toDate”
我该如何解决?
我正在尝试获取我在firestore中创建的文档的时间戳,但我得到的是:
myService.ts
getDomiciliarios() {
this.domiciliarios = this.afs.collection('domiciliarios').snapshotChanges().map(actions => {
return actions.map(a => {
const data = a.payload.doc.data() as Domiciliario;
const id = a.payload.doc.id;
const date = firebase.firestore.FieldValue.serverTimestamp();
return { id, ...data, date };
});
});
return this.domiciliarios;
}
Run Code Online (Sandbox Code Playgroud)
myComponent.ts
ngOnInit() {
const domiciliarios = this.fs.getDomiciliarios()
.subscribe(data => this.dataSource.data = data, date => date);
}
Run Code Online (Sandbox Code Playgroud)
myComponent.html
<ng-container matColumnDef="fecha">
<mat-header-cell *matHeaderCellDef mat-sort-header> Fecha </mat-header-cell>
<mat-cell *matCellDef="let domiciliario"> {{ domiciliario.date }} </mat-cell>
</ng-container>
Run Code Online (Sandbox Code Playgroud)
如果我之前创建了时间戳,我该如何打印该时间戳?
firebase typescript angularfire2 angular google-cloud-firestore
在Angular 6中导入引导程序的正确方法是什么.在以前的版本中,我这样做并且它正常工作.
angular-cli.json(Angular 5)
"styles": [
"styles.scss"
],
"scripts": [
"../node_modules/jquery/dist/jquery.slim.min.js",
"../node_modules/popper.js/dist/umd/popper.min.js",
"../node_modules/bootstrap/dist/js/bootstrap.min.js"
],
Run Code Online (Sandbox Code Playgroud)
angular.json(Angular 6)
"styles": [
"src/styles.css"
],
"scripts": [
"../node_modules/jquery/dist/jquery.slim.min.js",
"../node_modules/popper.js/dist/umd/popper.min.js",
"../node_modules/bootstrap/dist/js/bootstrap.min.js"
]
Run Code Online (Sandbox Code Playgroud)
得到错误:
Error: ENOENT: no such file or directory, open '/Users/pacozevallos/myApp/node_modules/jquery/dist/jquery.slim.min.js'
Run Code Online (Sandbox Code Playgroud) 我正在处理MatSnackBar的错误,我对显示对话框的位置有问题而且它没有自动隐藏.
service.ts
facebookLogin() {
const provider = new firebase.auth.FacebookAuthProvider();
return this.oAuthLogin(provider);
}
private oAuthLogin(provider) {
return this.afAuth.auth.signInWithPopup(provider)
.then((credential) => {
this.pushUserData(credential.user)
this.router.navigate(['/userProfile'])
})
.catch(error => {
this.handleError(error);
});
}
private handleError(error: Error) {
console.error(error);
this.snackBar.open(error.message, this.action, { duration: 1000 });
}
Run Code Online (Sandbox Code Playgroud)
component.ts
facebookLogin() {
this.auth.facebookLogin()
}
Run Code Online (Sandbox Code Playgroud)
当我从同一个组件测试它时,一切正常:
openSnackBar() {
this.snackBar.open(this.message, this.action, {
duration: 500,
});
}
Run Code Online (Sandbox Code Playgroud) 如何使用ngFor替换每行的列顺序?
例如,此处图像将始终位于右侧.我怎么能这样做,在每一行我交替,图像显示左边一个,右边一个,依此类推?
<div class="row" *ngFor="let servicio of servicios">
<div class="col-lg-5">
{{ servicio.titulo }}
</div>
<div class="col-lg-7">
<img src="{{ servicio.imagen }}" alt="">
</div>
</div>
Run Code Online (Sandbox Code Playgroud) 我想要的是克隆我在 Firebase 中的一个项目,并创建另一个相同但使用另一个 Google 帐户的项目。我可以完全访问这两个帐户。这可能吗?
然后我按照以下文档导出然后将数据导入 Firestore:https : //firebase.google.com/docs/firestore/manage-data/export-import
所以 - 在 gloud 控制台中 - 我在原始项目(存储)中尝试了以下内容:
gcloud beta firestore export gs://punkutravel.appspot.com
Run Code Online (Sandbox Code Playgroud)
我得到:
outputUriPrefix: gs://punkutravel.appspot.com/2019-10-27T17:09:39_35393
Run Code Online (Sandbox Code Playgroud)
都好。
那么我想将该数据导入另一个项目(使用另一个帐户)
我执行以下操作:
gcloud beta firestore import gs://punkutravel.appspot.com/2019-10-27T17:09:39_35393
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
错误:(gcloud.beta.firestore.import) NOT_FOUND:项目“anqasky-5861e”不存在。
我什至已将权限分配给源帐户,反之亦然,但仍未解决。
谁能告诉我如何获得该表中行的总值,另外我想要满足列属性的真或假条件的行的值。
https://stackblitz.com/edit/angular-g9twrl?embed=1&file=app/app.component.html
我的应用程序在本地运行良好,但是当我要投入生产时,ng build --prod
出现以下错误:
知道会发生什么吗?
找不到./node_modules/rxjs/_esm5/operators/index.js中的模块错误:错误:无法解析/Users/.../node_modules/rxjs/_esm5/operators中的'../internal/operators/endWith' '
package.json
{
"name": "myApp",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "6.0.5",
"@angular/cdk": "^6.3.3",
"@angular/common": "^6.0.0",
"@angular/compiler": "^6.0.0",
"@angular/core": "^6.0.0",
"@angular/forms": "^6.0.0",
"@angular/http": "^6.0.0",
"@angular/material": "^6.3.3",
"@angular/platform-browser": "^6.0.0",
"@angular/platform-browser-dynamic": "^6.0.0",
"@angular/router": "^6.0.0",
"angularfire2": "^5.0.0-rc.10",
"bootstrap": "^4.1.1",
"core-js": "^2.5.4",
"firebase": "^5.0.4",
"jquery": "^3.3.1",
"popper.js": "^1.14.3",
"rxjs": "^6.0.0",
"rxjs-compat": "^6.2.2",
"zone.js": "^0.8.26"
},
"devDependencies": …
Run Code Online (Sandbox Code Playgroud) angular ×12
firebase ×5
typescript ×5
bootstrap-4 ×2
ngfor ×2
angularfire2 ×1
gcloud ×1
html ×1
rxjs6 ×1