小编Lui*_*era的帖子

如何使用AngularFire在Firebase中保存DATE字段

我有一个带有日期字段(开始日期)的屏幕,用户可以在其中输入任何日期

<label class="item item-input">
     <span class="input-label">Start Date</span>
     <input type="date" ng-model="currentItem.OpenDate">
</label>
Run Code Online (Sandbox Code Playgroud)

我将以下内容添加到"保存"按钮的单击事件中

console.log("Normal date " + $scope.currentItem.OpenDate);
Run Code Online (Sandbox Code Playgroud)

控制台显示以下日期

Normal date Fri May 01 2015 00:00:00 GMT-0400 (Eastern Daylight Time)
Run Code Online (Sandbox Code Playgroud)

这是推送活动

$scope.data.accounts.push({ 'AccountName': $scope.currentItem.AccountName, 'StartBalance': $scope.currentItem.StartBalance, 'OpenDate': $scope.currentItem.OpenDate, 'AccountType': $scope.currentItem.AccountType });
Run Code Online (Sandbox Code Playgroud)

但是,日期$scope.currentItem.OpenDate未保存到Firebase,其余数据正在正常保存.我错过了什么?

firebase angularfire

7
推荐指数
2
解决办法
2万
查看次数

未捕获(承诺):FirebaseError

我收到以下错误。我的问题在于实际的错误,而在于它说错误是Uncaught。如果您查看我的auth.service.ts文件sign-in.component.ts,我会发现错误。

我的问题是,为什么在控制台中出现错误:未捕获(承诺)错误?我缺少什么?

我在用着
"@angular/fire": "^7.0.4"
"firebase": "^9.0.2"
"rxjs": "6.6.7"

在此输入图像描述

auth.service.ts

    /**
     * Sign in
     *
     * @param credentials
     */
    signIn(credentials: { email: string; password: string }): Promise<any> 
    {
        return this.auth.signInWithEmailAndPassword(credentials.email, credentials.password)
            .then((userCredential) => {
                
                // Signed in 
                const user = userCredential.user;
                //console.log(user);

                // Store the access token in the local storage
                userCredential.user.getIdToken().then(token => {
                    this.accessToken = token;
                    //console.log(token);
                })

                // Set the authenticated flag to true
                this._authenticated = true;

                // …
Run Code Online (Sandbox Code Playgroud)

javascript firebase angularfire firebase-authentication angular

6
推荐指数
1
解决办法
3835
查看次数

Firebase客户端扇出以实现数据一致性

从下面的打击帖

Firebase客户端扇出以实现数据一致性

多路径更新听起来很棒.对于多路径删除,这是否有效?

使用案例:我添加了一个新帖子,它被许多粉丝粉丝.我决定稍后删除该帖子.删除是否有效?你有一个例子吗?

firebase

5
推荐指数
1
解决办法
623
查看次数

升级到 Angular 13 后的 Mixins / Webpack 问题

将我的项目升级到 Angular 13 后,当我运行ng serve. 我还包括下面的package.jsonwebpack.config.js文件。

我已经尝试删除该node_modules文件夹并运行npm install但无济于事。

在此输入图像描述

在此输入图像描述

包.JSON

{
  "name": "acentus",
  "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": "^13.2.4",
    "@angular/cdk": "^13.2.4",
    "@angular/common": "^13.2.4",
    "@angular/compiler": "^13.2.4",
    "@angular/core": "^13.2.4",
    "@angular/fire": "^7.2.1",
    "@angular/forms": "^13.2.4",
    "@angular/material": "^13.2.4",
    "@angular/platform-browser": "^13.2.4",
    "@angular/platform-browser-dynamic": "^13.2.4",
    "@angular/router": "^13.2.4",
    "@iconify/icons-ic": "^1.0.11",
    "@ngneat/tailwind": "^7.0.3",
    "@ngrx-utils/store": "^0.13.1",
    "@ngrx/effects": "^11.0.1",
    "@ngrx/router-store": "^11.0.1", …
Run Code Online (Sandbox Code Playgroud)

webpack angular tailwind-css

5
推荐指数
0
解决办法
4458
查看次数