本文介绍了在 AngularFire 中使用限制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我现在拥有的代码:

This is the code I have right now:

 var url = 'https://*****.firebaseio.com/photos';
var promise = angularFire(url, $scope, 'photos', {});

promise.then(function() {

    //limit here.

});

我可以插入什么代码来限制从 Firebase 返回的内容仅限于具有指定优先级的内容(假设优先级为新")?

What code can I insert to limit what is returned from the firebase to only those have a specified priority (let's say the priority is "new)?

感谢您的帮助.

推荐答案

只需将已经有限的查询传递给 angularFire,如下所示:

Just pass in an already limited query to angularFire, like so:

var ref = new Firebase("https://*****.firebaseio.com/photos");
var promise = angularFire(ref.startAt("new"), $scope, "photos", {});

这篇关于在 AngularFire 中使用限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-02 11:53