Search Posts

Category: firebase-database

Inserting encapsuled object in firestore and goods practices

I have a question about to insert object in firestore in angularfire: My object Person.ts name: String age: Number //–constructor– //–getters and setters– if I do this, insert ok: (BUT is this good practice?) [person.component.ts] this.db.collection(“person”).add({ name: this.person.$nome, age: this.person.$email }) … but if I try: [person.component.ts] this.db.collection(“person”).add({ Person: this.entrevistador //or this this.person }) I get this error in browser console: Function DocumentReference.set() called with invalid data. Unsupported field value: a custom Person object (found […]

How to return asyncronously return data from firebase to devextreme grid in angular 4

Good day, could you help me with the question? I’m trying to receive data from firebase to devextreme component. I’m using angular4. Here is the code of my html page: <dx-data-grid [dataSource]=”priorities”> <dxi-column dataField=”Priority”></dxi-column> </dx-data-grid> In the class of my component I receive the data from database this way: ngOnInit() { this.ds.list(‘priority’).valueChanges().subscribe( data => { console.dir(data) for(var k = 0; k<data.length; k++){ var prior = new priority(); prior.Prioritie = data[k].toString(); this.priorities.push(prior); } console.dir(this.priorities);} where priorities […]

Push firebase uid to multiple locations – Angularfire2 Ionic 3

I have the following which simply pushes a name into the database along with a uid. I would like to store that uid in another location at the same time. How can I achieve this? Im using ionic 3, angularfire2. addName() { let prompt = this.alertCtrl.create({ title: ‘Name of user’, message: “Enter a name for this new user”, inputs: [ { name: ‘Name’, placeholder: ‘Username’ }, ], buttons: [ { text: ‘Cancel’, handler: data => […]

Firebase – Keep user signed in when redirecting to different page

I have 2 components to my website: The landing page with a sign up form (https://example.com) The single page anuglarjs application (https://app.example.com) What I want to achieve is when the users comes to the landing page, they are able to sign up using Firebase, and once the sign up is complete, redirect the user to the single page application and automatically be signed in, so they don’t have to enter their information again. Here is […]

ionic2 Angular2 import/export JSON data

What I mean by import/export data and why it needs to be implemented.. 1) I want my app to work offline – store data added by user while offline. 2) The data stored in JSON format. 3) I want that JSON data to export in a file and stored in phone memory. 4) Multiple files will be created. 5) When user get internet – the exported file will be imported and that JSON object to […]

Jquery Datatables not displaying data properly with angular

Used ng-repeat with datatables but the output is a bit weird. It shows the data but then it says that there are no records to display. If I try to search, sort it just empties out the table all together. Following is my current code with a screen shot of what i’m getting in the table! HTML <table class=”table table-bordered bordered table-striped table-condensed datatable” id=”exTable” ui-jq=”DataTable” ui-options=”dataTableOpt”> <thead class=”lockedRecordsBg”> <tr> <th>Equipment</th> <th>System</th> <th>Description</th> <th>Group</th> </tr> […]

Firebase Angular nested tree view

I have a dataset that looks like this inside of Firebase. Its basically a hierchical view of categories: In my angular app, my template looks like this: <ul> <li class=”text” *ngFor=”let item of items | async”> <input [(ngModel)]=”item.name”> <button (click)=”updateItemFromList(item.$key, item.name)”>Update</button> <button (click)=”removeItemFromList(item.$key)”>Delete</button> <button (click)=”addChildCategory2(item.$key, item)”>Add Child Category</button> <ul> <li *ngFor=”let childCategory of item.children”> <input [(ngModel)]=”childCategory.name”> </li> </ul> ….. Here is how I’m loading items: export class AppComponent { title = ‘My App’; db: any; […]

Datetime-local not working with firebase-database

I’m trying to insert 4 values into my firebase-database (Equipment, Type, start of downtime and end of downtime). The start and end of downtime values are in datetime-local. When I try inserting the values it only makes nodes for the first 2 values being equipment and type. I don’t know why its not inserting the datetime-local values. MY HTML <div class=”row”> <div class=”col-xs-12″> <div class=”form-group col-xs-6 col-xs-offset-3″ id=”equipList”> <label for=”selectequ”>Select Equipment</label> <select class=”form-control” id=”selectequ” data-ng-model=”equipment” […]

My loop is only displaying the last data value in my view – firebase

I’m trying to display all the equipment list that i retrieve from the firebase database using angular.foreach but when ever i try to display the retrieved values in my view it only displays the last value. Need help! My JS /*global angular*/ var app = angular.module(‘sdt’, [‘ngRoute’, ‘firebase’]); app.config([‘$routeProvider’, function ($routeProvider) { ‘use strict’; $routeProvider.when(‘/sdt’, { templateUrl: ‘searchdowntime/sdt.html’, controller: ‘sdtCtrl’ }); }]); app.controller(‘sdtCtrl’, [‘$scope’, ‘$firebaseObject’, ‘$firebaseArray’, function ($scope, $firebaseObject, $firebaseArray) { ‘use strict’; var ref […]

Child Class auto generates id when pushing data in firebase database

I am trying to push data into by firebase database using angularjs. I used the system as the key and then the equipment as the child, but when i push the data it generates a key and under that it stores the equipment. I want it to store my data like so: System -> Equipment1 -> Equipment2 -> Equipment3 System2 -> Equipment1 -> Equipment2 -> Equipment3 Here is my code: /*global angular*/ var app = […]

Next Page »