Quantcast
Channel: Ionic Forum - Latest topics
Viewing all 71028 articles
Browse latest View live

Firebase : How to manipulate data (Observable) returned by valueChanges()

$
0
0

@mairaeva wrote:

I’m trying to manipulate my data (get the GPS position of users) from Firebase within the TS controller.
I can do that in the template but how to get the “GPS” fields within the TS ?

here is my Observable list from firebase (map.ts) :

this.items = database.list('user').valueChanges();

Here is how to display them within the template (map.html) :

<li *ngFor="let item of items | async">
      {{ item.GPS }}
</li>

I guess I am supposed to subscribe and then do a FOREACH loop like this :slight_smile:

database.list('user').valueChanges().subscribe(res => {
      console.log("res" + res);
      res.forEach(item => {
        console.log("item" + item.GPS);
      });
    });

But off course the “GPS” field is unknown

Here is my JSON DATA from firebase

  "user" : {
    "-KxFJWl6Hcq8sguzqHUO" : {
      "GPS" : "-17.6118169,-149.6097454",
      "mail" : "xxx@xxxx.com",
      "timestamp" : 1508907172088
    },
    "-KxFKYmHnd3dzlaNgrR3" : {
      "GPS" : "-17.6118169,-149.6097454",
      "mail" : "xxx@gmail.com",
      "timestamp" : 1508907133193
    },
    "-KxGPgl0HSD4k60GxDba" : {
      "GPS" : "-17.551625100000003,-149.5584758",
      "mail" : "xx@xxx.com",
      "timestamp" : 1508899499230
    }
  }

ionic 3.15.0
angularfire 5

Posts: 1

Participants: 1

Read full topic


Ion-fab color - how to control

$
0
0

@kemety wrote:

I have looked around a lot and could not find out how I can control/change the ion-fab icons color and background color or set them to a custom color. I tried color="#FF6600" and it didn’t work. I tried scss and the background-color only changes a portion of the circle… Can anyone point me to the documentation on how to control this? Thanks.

Posts: 3

Participants: 2

Read full topic

Ionic doctor check Issue (CORS?)

Duration of notification?

Error while importing firebase config in app.firebase.config.ts file

$
0
0

@mahaveer08 wrote:

I have created a file called app.firebase.config.ts under folders src --> app. and have pasted firebase config code. Below is the code.

export const FIREBASE_CONFIG = var config = {
    apiKey: "AIzayAwgrPgDgJrS237oxoNz",
    authDomain: "cleaningapp-808.firebaseapp.com",
    databaseURL: "https://cleaningapp-8f8.firebaseio.com",
    projectId: "cleaningapp-8f408",
    storageBucket: "cleaningapp-8f8.appspot.com",
    messagingSenderId: "3656323539"
  };

I am getting an error for “var” saying [ts] Expression expected
Below is the screenshot of the error.

Posts: 2

Participants: 1

Read full topic

Error when updating to Ionic CLI 3.15.0

$
0
0

@codiqa100078139 wrote:

Hi I am trying to update the Ionic CLI to 3.15.0 and I get this error

? The Ionic CLI has an update available (3.14.0 => 3.15.0)! Would you like to install it? Yes

npm i -g ionic@latest
× Running command - failed!
Error
at ShellException.Exception (C:\Users\Dani\AppData\Roaming\npm\node_modules\ionic\node_modules@ionic\cli-utils\lib\errors.js:8:23)
at ShellException (C:\Users\Dani\AppData\Roaming\npm\node_modules\ionic\node_modules@ionic\cli-utils\lib\errors.js:26:9)
at ChildProcess.p.on.code (C:\Users\Dani\AppData\Roaming\npm\node_modules\ionic\node_modules@ionic\cli-utils\lib\utils\shell.js:68:28)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:194:7)
at ChildProcess.cp.emit (C:\Users\Dani\AppData\Roaming\npm\node_modules\ionic\node_modules\cross-spawn\lib\enoent.js:40:29)
at maybeClose (internal/child_process.js:899:16)
at Socket. (internal/child_process.js:342:11)
at emitOne (events.js:96:13)
at Socket.emit (events.js:191:7)

What is the problem here?

Posts: 1

Participants: 1

Read full topic

Structuring data: How to combine data from different firebase list

$
0
0

@jose_inesta wrote:

Hi,

we are designing an appointment system based on Ionic 3 and Firebase. Shortly, we have:

  • A list of appointments with “workers” and “patients” properties
  • A list of users

User will be possible to see a list of associated appointments in a list.

Every item list will show something like this:

 _______________________________________
| Date: 17/3/2017   Patient: Jonh Snow  |
| Start: 13:48      Worker: Ana Stark   |
 ---------------------------------------
 _______________________________________
| Date: 15/3/2017   Patient: Jonh Snow  |
| Start: 22:48      Worker: Ana Stark   |
 ---------------------------------------

[ ... more items in list ... ]

For worker and patient name, we should store plain text or a key reference to user list? How we should structure the firebase appointment list in terms of scalability, performance and updates?

If we would use the second approach, How can I get data and combine from two diferents nodes with Ionic without performance issues?

This is our first approach with uid and plain text names:

{
  "appointments": {
    "appointmentkey1": {
      "start": "1508919619",
      "end": "1508959219",
      "worker": {
        "uid": "userkey1",
        "name": "Ana Stark"
      },
      "patient": {
        "uid": "userkey2",
        "name": "Jonh Snow"
      }
    },
    "appointmentkey2": {
      "start": "1508914617",
      "end": "1508912234",
      "worker": {
        "uid": "userkey1",
        "name": "Ana Stark"
      },
      "patient": {
        "uid": "userkey2",
        "name": "Jonh Snow"
      }
    }

    [...]

  }
}

This is the second approach only with uid key:

{
  "appointments": {
    "appointmentkey1": {
      "start": "1508919619",
      "end": "1508959219",
      "worker": "userkey1",
      "patient": "userkey2"
    },
    "appointmentkey2": {
      "start": "1508914617",
      "end": "1508912234",
      "worker": "userkey1",
      "patient": "userkey2"
    }
  }
}

User list would be the same for both:

{
  "users": {
    "userkey1": {
      "name": "Ana Stark",
      "birthday": "1508959219",
      "address": "north"
    },
    "userkey2": {
      "name": "Jonh Snow",
      "birthday": "1508953219",
      "address": "south"
    }
  }
}

Thanks in advance for your suggests

Posts: 1

Participants: 1

Read full topic

Can't get cordova-plugin-recentscontrol to work

$
0
0

@xxmuaddib wrote:

Hello,

So far, I added the plugin to my project. Tried to add these two lines into config.xml

<preference name="RecentsBackgroundColor" value="#000000" />
<preference name="RecentsDescription" value="MyApp" />

It didn’t work.

Now I am trying to use RecentsControl object, which according to documentation has several methods, including RecentsControl.setColor(colorStr) , but I do not understand where from to import that object.
The link to documentation: https://github.com/FPCSJames/cordova-plugin-recentscontrol

Thanks in advance

Posts: 1

Participants: 1

Read full topic


Https not working?

Convert HTML to PDF in IONIC

$
0
0

@suubcs wrote:

Hello guys, i want to convert an HTML template to PDF , i used jsPDF library that can do the job , but it’s not working in ionic , any one here have any other library or any idea to convert HTML to PDF ?

Posts: 1

Participants: 1

Read full topic

Access to storage values in Ionic3

$
0
0

@luden wrote:

Hi,
I would like to be able to get the more simplest array of the storage object in Ionic 3
I did that already :

this.item = Array.of(this.storage.get(‘thestations’));

And i get this type of array in the console view of chrome :

[t]
0
:
t
__zone_symbol__state
:
true
__zone_symbol__value
:
Array(1)
0
:
{id: “3015”, name: “Mansle”, latitude: “85.878”, longitude: “8.17527”, numdept: “16”, …}
length
:
1
proto
:
Array(0)
proto
:
Object
length
:
1
proto
:
Array(0)

I wish to get this values in a simple array {id: “3015”, name: “Mansle”, latitude: “85.878”, longitude: “8.17527”, numdept: “16”, …} ?

Regards
Frank

Posts: 1

Participants: 1

Read full topic

Ionic and SVN - version management

$
0
0

@jooo13 wrote:

I’m working on an ionic application with two other persons and we’re using SVN to manage the app code source versions.

I’m wondering if the following files must be commited while commiting the changes made in the project to the SVN server or they will be generated automatically while building the app :

  • workspace.xml
  • vendor.js
  • main.js
  • config.xml

Posts: 1

Participants: 1

Read full topic

Unable to npm install insomnia

$
0
0

@gauravgupta0305 wrote:

I’m trying to use Insomnia to make my application alive from falling asleep.

I tried following the steps mentioned on docs - https://ionicframework.com/docs/native/insomnia/

  1. Cordova plugin added successfully.
  2. Npm install gives me error as :

npm install --save @ionic-native/insomnia
[App_Name]@0.0.7 C:\Workspace[App-Name]-mobileapp
±- UNMET PEER DEPENDENCY @ionic-native/core@3.12.1
`-- @ionic-native/insomnia@4.3.2

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“win32”,“arch”:“x64”})
npm WARN @ionic-native/insomnia@4.3.2 requires a peer of @ionic-native/core@^4.2.0 but none was installed.

I did tried updating and installing ionic-native using npm command as -
npm install @ionic-native/core --save

but it results an error as-

npm install @ionic-native/core --save
[App_Name]@0.0.7 C:\Workspace[App_Name]-mobileapp
`-- UNMET PEER DEPENDENCY @ionic-native/core@3.12.1

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“win32”,“arch”:“x64”})
npm WARN @ionic-native/insomnia@4.3.2 requires a peer of @ionic-native/core@^4.2.0 but none was installed.

Thanks in advance if anyone can provide my any help.

Posts: 1

Participants: 1

Read full topic

How to implement login with social media in ionic?

Ion-content overlaps in ion-header

$
0
0

@dvtopiya wrote:

We have a listing page and filter page in ionic app. Filter page is having a textbox-autocomplete and dropdown. When trying to filter with textbox-autocomplete ion-content goes inside ion-header as shown in below snapshots.

Textbox-Autocomplete html:

<input type="text" [(ngModel)]="selectedTitle" (input)="getTitles($event)" placeholder="search titles" />
  <ion-list *ngFor="let title of titles">
    <ion-item tappable (click)=selectTitle(title.NAME)>
      {{title.VNAME}}
    </ion-item>
  </ion-list>

This is happening only with the latest version of ionic Info:

    @ionic/cli-utils  : 1.14.0
    ionic (Ionic CLI) : 3.14.0

global packages:
   cordova (Cordova CLI) : 7.0.1

local packages:
    @ionic/app-scripts : 1.3.7
    Cordova Platforms  : android 6.2.3
    Ionic Framework    : ionic-angular 3.7.1

System:
    Node : v6.9.5
    npm  : 3.10.10
    OS   : Windows 10

Misc:
    backend : legacy

But with below old version it is working fine.

Ionic info :

@ionic/cli-utils  : 1.9.1
ionic (Ionic CLI) : 3.9.1

global packages:
Cordova CLI : 7.0.1

local packages:
@ionic/app-scripts : 1.3.3
Cordova Platforms  : android 6.2.3
Ionic Framework    : ionic-angular 3.5.3

System:
Node : v6.9.5
npm  : 3.10.10
OS   : Windows 10

Can anyone please guide us to solve this?

Posts: 2

Participants: 2

Read full topic


Leaflet Marker Disappears in a second after load

$
0
0

@lifesuxtr wrote:

I am trying to add a marker on leaflet map.After 1-second marker disappears.

import { Component, ViewChild, ElementRef } from '@angular/core';
import { NavController } from 'ionic-angular';
import leaflet from 'leaflet';
import { AngularFireDatabase } from 'angularfire2/database';
import { AngularFireAuth } from 'angularfire2/auth';

@Component({
    selector: 'page-map',
    templateUrl: 'map.html'
})
export class MapPage {

    @ViewChild('map') mapContainer: ElementRef;

    api: string;
    msgData: FirebaseListObservable<any[]>;

    constructor(private fire: AngularFireAuth, private db: AngularFireDatabase, public navCtrl: NavController) {
        this.api = 'https://api.mapbox.com/styles/v1/mapbox/navigation-guidance-day-v2/tiles/256/{z}/{x}/{y}?access_token=pk.eyJ1IjoibGlmZXN1eHRyIiwiYSI6ImNqOGp4bjZsNTA3M2EycXJ0cjhmaHMzbWIifQ.cV0Jbzh0fpEHQdANWN0Ejg'
    }

    ionViewDidEnter() {
        this.loadmap();
    }

    getObjectWithoutKnowingKey(data) {
        let objects = [];
        for (var propName in data) {
            if (data.hasOwnProperty(propName)) {
                objects.push(data[propName]);
            }
        }
        return objects;
    }
    loadmap() {

        this.msgData = this.db.list(`/messages/`).valueChanges();
        this.msgData.take(1).subscribe(msg => {

            this.map = leaflet.map("map").fitWorld();
            let markerGroup = leaflet.featureGroup();

            leaflet.tileLayer(this.api, { attributions: '', maxZoom: 18 }).addTo(this.map);

            this.map.locate({
                setView: true,
                maxZoom: 40
            });

            let marker: any = leaflet.marker([40, 39]).on('click', () => {
                marker.bindPopup("testing").openPopup();
            });
            markerGroup.addLayer(marker);
            this.map.addLayer(markerGroup);

            //let data = msg.map(this.getObjectWithoutKnowingKey)

            //this.map.addLayer(markerGroup);
        });
    }
    ionViewDidLeave() {
        this.map.remove();
    }
}

Don’t mind database code, I will use it later for database purposes. Right now I’m just trying to put a marker on the map.Maybe it’s not working because of it writing map code inside this.msgData.take(1).subscribe(msg =>{} block? but i tried without it still same. thanks.

Posts: 1

Participants: 1

Read full topic

iOS throttling ajax requests

$
0
0

@gnesher wrote:

Hi,

I’m offering background sync of images which works fine with a small number of images, but seems to stall once we reach 10± images that are being synced simultaneously (files are quite small, roughly 200k on a wifi connection).

This seems to only happen on iOS and I’m wondering if there’s some hard limit to the number of simultaneous requests I’m able to make with Ajax?

I realize there might be better ways of handling this, but I’m currently stuck with this solution :confused:

Posts: 1

Participants: 1

Read full topic

Some way to get back to root page while live reloading?

$
0
0

@jiotaro wrote:

Hi everyone,

I must say it’s a painful task whenever I make changes
It just keeps on previous active page, thus make injected providers cannot work due to initialization when the app boots up

so I just want to go back to latest root page while reloading, any way to do so?

ps: I think it’s related to some kind of app’s resume event, but I can’t find any docs about it

Posts: 4

Participants: 2

Read full topic

Spinner - Where can I change the name of the default spinner?

$
0
0

@inesgomes wrote:

Ionic 3

I would like to change the default spinner of the splash screen to “dots”!
I already looked over the cordova-plugin-splash-screen folder, but I can´t realize where can I change the spinner name.

The default spinner starts with the splash screen and works very well. But I want to change its name and position.

Posts: 1

Participants: 1

Read full topic

Ionic Order by List

$
0
0

@amine216 wrote:

I need to order by ‘Gain’ the list with Ionic 2

fichier json

etalon: [
{
nom_cheval: "TIDJAM LOTOIS_1999",
vict: 8,
plc: 6,
Gain: 102925
},
{
nom_cheval: "DJELMANE_1999",
vict: 15,
plc: 23,
Gain: 212405
},
{
nom_cheval: "MAKZAN_1991",
vict: 4,
plc: 5,
Gain: 44165
},
{
nom_cheval: "NIZAM_1998",
vict: 3,
plc: 5,
Gain: 53675
},
{
nom_cheval: "MUNEEF_2001",
vict: 8,
plc: 23,
Gain: 97885
},
]

Posts: 2

Participants: 2

Read full topic

Viewing all 71028 articles
Browse latest View live