标签: angularfire

如何将 CakePHP 3 应用程序与 Firebase 集成

阅读了几个小时的文档和教程后,我最终陷入了更多的困惑。因此,我在这里请求您的帮助/提示,​​我非常感谢您的任何努力帮助我更进一步。对于我可能犯的任何错误,我很抱歉,可以这么说,我在这个主题上还是个新手。

我正在构建一个 Web 应用程序,实际上是一个网页,一旦收到来自外部源的 GET/POST 请求,它就会开始运行。所以,如果收到任何请求,页面就会异步更新,为此我想到了稍后在前端使用 AngularJS 和 AngularFire。我知道还有很多其他方法,而且可能也更简单,但我很好奇如何将我的 CakePHP 应用程序与 Firebase 平台集成。所以,我们继续使用CakePHP + Firebase现在

到目前为止,使用 SDK Firebase PHP 客户端很有意义,但是,我仍然对需要操作的文件感到困惑。由于使用 CakePHP3 框架和 Firebase 的示例并不多(到目前为止我还没有找到),所以我被困在这里,非常感谢这里的任何帮助。首先,这段代码在链接中给出,我想知道它是如何工作的以及这些变量和常量代表什么。

const DEFAULT_URL = 'https://kidsplace.firebaseio.com/';
const DEFAULT_TOKEN = 'MqL0c8tKCtheLSYcygYNtGhU8Z2hULOFs9OKPdEp';
const DEFAULT_PATH = '/firebase/example';

$firebase = new \Firebase\FirebaseLib(DEFAULT_URL, DEFAULT_TOKEN);

// --- storing an array ---
$test = array(
    "foo" => "bar",
    "i_love" => "lamp",
    "id" => 42
);
$dateTime = new DateTime();
$firebase->set(DEFAULT_PATH . '/' . $dateTime->format('c'), $test);

// --- storing a string ---
$firebase->set(DEFAULT_PATH …
Run Code Online (Sandbox Code Playgroud)

php cakephp firebase angularfire cakephp-3.0

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

Angularfire 6为所有函数设置默认云函数区域(位置)

如何通过 Angular Fire全局设置 Firebase 云函数的默认区域,以便将它们部署到指定区域?或者它不必是有角度的火。我只是不想.region('')在每个函数声明中调用方法。

我在文档中找不到有关如何执行此操作的任何内容。但我听说这应该是可能的。以前版本的 Angular Fire 应该支持它。

angularfire google-cloud-functions

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

在集合中设置自定义 ID - AngularFire 7 和 Firebase

如何在新的 Angularfire 7 中为文档设置自定义 ID?

我不想要自动生成的..

我的代码:(这会创建一个自动ID,一个想放我自己的ID)

  addInfos(infos: any) {
    const notesRef = collection(this.firestore, "infos");
    return addDoc(notesRef, infos)
  }
Run Code Online (Sandbox Code Playgroud)

javascript firebase angularfire google-cloud-firestore

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

来自firebase的数据未在路由更改时加载,但在刷新时进行

我使用angularFire与角更新一些意见,但奇怪的是,当我从视图切换到查看数据不加载,但是当我刷新页面它.这是怎么回事?

WizardController:

/* initialize data */

var ref = new Firebase('https://dlwj.firebaseio.com/');

/* set data to automatically update on change */

$scope.currentLocation = $route.current.$$route.originalPath;
$scope.propertyRef = $firebase(ref);

$scope.propertyRef.$on('loaded', function(value) {

  //value will be undefined when I switch views using hash routes.
  //there is no issue when I just refresh on that page.
  console.log(value); 
  $scope.propertyConfiguration = value.products;
  var products = [];
  for (var key in value.products) {
    if (value.products.hasOwnProperty(key)) {
      products.push(key);
    }
  }

  $scope.productsArray = products;

});

console.log('Data retrieved');
Run Code Online (Sandbox Code Playgroud)

路线:

$routeProvider.when('/SharedProperties',
{ …
Run Code Online (Sandbox Code Playgroud)

angularjs firebase angularfire

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

FireBase托管依赖吗?

我用AngularFire创建了一个非常简单的FireBase + Angular应用程序,或者更确切地说,我复制了示例中的代码.目前,它只允许通过Google登录和退出.代码很简单,我认为甚至不需要在这里发布它.

我尝试了不同的静态文件托管解决方案,并得到了一些奇怪的结果.

在Google云端硬盘,Dropbox和Github上.虽然这些页面都是在所有页面上提供的,但是在控制台中没有404错误和JS错误,登录本身也不起作用.会发生什么是该程序将启动登录屏幕并登录用户,但角度"auth.user"对象保持为null.

完全相同的代码,当在Visual Studio上运行时(仅通过"在浏览器中查看文件")并且也在FireBase自己的托管解决方案上运行,按预期运行,没有问题.登录和注销都有效.

我想知道这是怎么回事,因为这是一个"没有后端"的应用程序,或者更确切地说,它具有相同的后端,即FireBase服务.

这里发生了什么?

有关 在Dropbox和Github 上托管的Google Drive 主机的解释

(关于如何改进这个问题的评论将受到关注)

angularjs firebase angularfire firebasesimplelogin

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

如何将angularfire(angular + firebase)项目推送到heroku?

关于heroku的最接近的教程是我正在做的是节点教程,但这对我的目的来说并不完全正确.我有一个angularfire项目,没有节点的东西.我该如何处理?也许我甚至不需要heroku?什么是让我的东西在线更好的方法?谢谢!

heroku angularjs firebase angularfire

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

如何查询firebase以检索唯一ID

我使用以下代码从Firebase查询数据:

var firebaseObj = new Firebase("https://example.firebaseio.com/Articles");

var sync = $firebase(firebaseObj);

$scope.articles = sync.$asArray();
Run Code Online (Sandbox Code Playgroud)

返回以下数据:

    [{
    "emailId": "ty@ty.com",
    "post": "fgh",
    "title": "hfgh"
}, {
    "emailId": "kj@hjgfh.com",
    "post": "HHHHHH",
    "title": "Hello"
}, {
    "emailId": "hkj@gmail.com",
    "post": "Big news",
    "title": "Today's news"
}]
Run Code Online (Sandbox Code Playgroud)

返回的每个条目https://example.firebaseio.com/Articles都有一个唯一的ID,该ID在返回的结果中缺失.如何检索唯一ID.

javascript firebase angularfire

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

Angular auth.guard没有持久身份验证

刷新页面后,身份验证似乎并不持久。每当我登录时,它都会成功重定向我。但是,当我刷新时,再也无法访问了。

这是身份验证保护

路由器

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { FormsModule } from '@angular/forms';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { NavComponent } from './components/nav/nav.component';
import { HomeComponent } from './components/home/home.component';
import { GalleryComponent } from './components/gallery/gallery.component';
import { FooterComponent } from './components/footer/footer.component';

import { AngularFireModule } from 'angularfire2';
import { AngularFireAuthModule } from 'angularfire2/auth';
import { AngularFireDatabaseModule, AngularFireDatabase …
Run Code Online (Sandbox Code Playgroud)

javascript firebase angularfire firebase-authentication angular

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

如何正确使用Cloud Functions到Angular组件?

我在Firebase上创建了一个云功能,我正在尝试对它进行POST方法.我该怎么把这个函数触发到Angular组件?

这是我做的:

  const url = 'my-cloud-function-url';
  const params: URLSearchParams = new URLSearchParams();

  params.set('id', this.id);

  this.http.post(url, params)
      .toPromise()
      .then(res => {
          console.log(res);
       })
       .catch(err => {
          console.log(err);
       });
Run Code Online (Sandbox Code Playgroud)

所以这段代码正在运行,但POST方法不接受参数中的参数.我知道我可以更改url以在其中添加参数但我很确定这是脏方法.

谢谢你的帮助!

firebase angularfire google-cloud-functions angular

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

类型'void'Angular 6上不存在属性'pipe'

我不明白问题的原因.我的代码来自ServiceFile,我得到错误

  1. 类型'void'上不存在属性'pipe'.
  2. 类型"{}"上不存在属性"$ key".

https://i.imgur.com/0m0HmKi.png

import { Injectable } from '@angular/core';
import { AngularFireDatabase, AngularFireList } from '@angular/fire/database';
import { switchMap } from 'rxjs/operators';
import { Observable } from 'rxjs';
@Injectable({
  providedIn: 'root'
})
export class CoursesService {

  constructor(private af: AngularFireDatabase) { }

  findAllCourses(): AngularFireList<any> {
    return this.af.list('courses');
  }

  findCourseDtl(coursUrl:string){
   this.af.list('courses', ref => ref.orderByChild('url').equalTo(coursUrl)).valueChanges()
  }

  findLessonsForCours(coursUrl:string): Observable<any>{
    return this.findCourseDtl(coursUrl)
   .pipe(switchMap(course => this.af.list('lessonsPerCourse/'+ course.$key ).valueChanges()));


}

}
Run Code Online (Sandbox Code Playgroud)

rxjs typescript angularfire angularfire2 angular

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