angularfire

Stuck at deleting parent pushed key by value/childkey

限于喜欢 提交于 2019-12-18 09:49:12
问题 I want to delete a parent pushed key by value/childkey: export class FaqsPage { qS: Observable<any[]>; ques = ''; ans = ''; constructor(private db: AngularFireDatabase) {} ionViewDidLoad() { this.qS = this.db.list('table/faq').valueChanges(); } removeItem(id){this.db.list('table/faq').remove(id);} removeItem() deleting the whole all pushed keys. No wonder because i couldn't get the parent key //faq.html <ion-list> <ion-item-sliding *ngFor="let el of qS | async"> <ion-item> <b>{{ el.Q }}</b>

How can I get a single record from AngularFire collection synchronized from Firebase

匆匆过客 提交于 2019-12-18 05:16:25
问题 I am having trouble getting a single record from an AngularFire synchronized array. This is my service: app.factory("Projects", ["$firebaseArray", function($firebaseArray) { // create a reference to the Firebase where we will store our data var ref = new Firebase("https://XXXXXXXXXX.firebaseio.com"); var childRef = ref.child('projects'); var projects = $firebaseArray(childRef); return { all: projects, create: function (projects) { return projects.$add(project); }, get: function (projectId) {

Setting Your Own Key When Adding an Object to Firebase - AngularFire

可紊 提交于 2019-12-18 04:34:33
问题 I can use the following to add an object to my Firebase data store: var uniqueId = { name: "a name", location: "new york" } $scope.myItems.$add(uniqueId).then(function(firebaseId){ // do something on success }, function(){ // do something if call fails }); The above will add an object into my data store and if the add is successful, an ID generated by Firebase is returned. The object I just added is saved under this key. Is there a way for me to specify what the key name is when I add to my

Trying to get child records from Firebase

故事扮演 提交于 2019-12-17 21:15:16
问题 Am in the angular-fire-seed tutorial stage and experimenting with messages and child posts, for some bizarre reason I cannot see the children when I explicitly try to display them, but can see it when expanding on the parent node in the console. These messages display properly in the html where I have the ng-repeat, so I know I am getting the messages at least, albeit childless. I thought angularfire-seed utils might be chopping or slicing some children so I reverted to straight firebase This

AuthGuard doesn't wait for authentication to finish before checking user

倖福魔咒の 提交于 2019-12-17 19:27:21
问题 I've read the guide here: https://angular.io/docs/ts/latest/guide/router.html Seems pretty straightforward, however, I'm not sure how to use angularfire2's authentication within an auth guard ( canActivate ). What I've tried is: AuthService import { Injectable } from '@angular/core'; import { AngularFire } from 'angularfire2'; @Injectable() export class AuthService { private user: any; constructor(private af: AngularFire) { this.af.auth.subscribe(user => { this.user = user; }) } get

AngularJS : Fetch records for pagination from Firebase

荒凉一梦 提交于 2019-12-17 17:08:36
问题 I'm trying to implement pagination using AngularJS with Firebase as back end. I'm using the below code to fetch data from firebase url: var firebaseObj = new Firebase("<firebaseUrl>.com/Details/"); var sync = $firebase(firebaseObj.startAt($scope.username).endAt($scope.username).limitToFirst(5)); $scope.articles = sync.$asArray(); The above query gives me the first 5 records which start and end with the particular username . Now how to get the next set of data from index 6 to 10. Any help

Is it possible to .sort(compare) and .reverse an array in angularfire?

帅比萌擦擦* 提交于 2019-12-17 16:54:25
问题 Update: The problem I'm having is doing a combination of three things: Adding a header to an array when the $priority (set to date created) changes. This is so I can group tasks by week and day in an ng-repeat. Resorting that list when a task is checked. Checked tasks should go to the bottom. When creating new tasks, I need to add them to the top of the list instead of the bottom. Here is a plnkr of all the code: http://plnkr.co/edit/A8lDKbNvhcSzbWVrysVm I'm using a priorityChanged function

How to implement a role based access control with AngularFire

て烟熏妆下的殇ゞ 提交于 2019-12-17 14:27:35
问题 My understanding is that I need to undertake the following steps: Make the users' roles read-only Use security rules on the data which access the roles to control access Check for the role in the router There are various examples on the official documentation how to deal with the security rules, but I couldn't figure out how to check for the role in the router. Let's assume I have an admin-only area, if someone who is not an admin tries to access that page I want that user to be redirected. I

Rendering information of each child in a list of a denormalized data structure

谁说我不能喝 提交于 2019-12-14 03:25:41
问题 Let say there is some data of students that are in classes ( groups ) of different schools : { "students": { "alexa" : { "firstName" : "ReJina", "grade" : 2, "lastName" : "idk", ... }, "bobby" : { ... }, "chris" : { ... }, ... }, "schools": { "springfield" : { "name" : "Springfield Elementary", "location" : "123 Main St", ... }, "quahog" : { ... }, "zion" : { ... }, ... }, "group": { "one" : { "members" : { "alexa" : true, "bobby" : true, "chris" : true }, "school" : { "springfield" : true },

How do I put a localStorage var inside my ng-show ? (Angular JS/Firebase)

江枫思渺然 提交于 2019-12-14 03:21:21
问题 SITUATION: When I load a page and didn't log in yet, everything works fine and I only see Login and Register in my nav as should be the case. But when I log in and I load any page, the nav will stay for about 0.5 to 1 seconds in a strange state where "Register", "Log in", "Profile" and "Log out" all appear at the same time. Then the nav appears as it should: showing only "Profile" and "Log out" . EDIT: ng-cloack fixed this, but profile and log out don't appear when I log in. CODE: header.ejs