Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all 48984 articles
Browse latest View live

Pass filter value

$
0
0

@simonioannides wrote:

Hello i want to filter the array that it is returned. I have this on.html file

        <ion-col col-3>
          <a class="circle" (click)="filter('T')">
            <ion-icon name="document" [ngClass]="mediaType == 'T' ? 'active' : ''"></ion-icon>
          </a>
        </ion-col>

and this is the values and functions i have on .ts file

        export class AllMediaPage {

	allMedia:any =[];
	mediaType:string = '';

	constructor(


        
	allMediaSet(){
		this.userData.allMedias(this.mediaType)
		.map(res => res.json())
		.subscribe(data => {

			if (data.success) {
				this.allMedia = data.mediaFeed;
			}
		}); 
	}


      filter(mediaType: any) {
		this.mediaType = mediaType;
	}

Posts: 1

Participants: 1

Read full topic


Firebase Analytics runtime error

$
0
0

@wespaul541 wrote:

Hi,

I been searching this error in the web but no luck.

error : “this.fba.logEvent().then() is not a function.”

import { Injectable } from ‘@angular/core’;
import { FirebaseAnalytics } from ‘@ionic-native/firebase-analytics’;

@Injectable()
export class EventLoggerProvider {

constructor(public fba: FirebaseAnalytics) {
console.log(‘Hello EventLoggerProvider Provider’);
}

logButton(name:string,value:any){
this.fba.logEvent(name, { pram:value })
.then((res: any) => {console.log(res);})
.catch((error: any) => console.error(error));
}
}

This is my ionic version.

cli packages: (D:\dev\mobile\final\proj\node_modules)

@ionic/cli-plugin-proxy : 1.5.8
@ionic/cli-utils        : 1.19.3
ionic (Ionic CLI)       : 3.20.1

global packages:

cordova (Cordova CLI) : 8.0.0

local packages:

@ionic/app-scripts : 3.2.1
Cordova Platforms  : android 7.0.0 browser 5.0.4
Ionic Framework    : ionic-angular 3.9.2

System:

Android SDK Tools : 26.1.1
Node              : v8.9.1
npm               : 6.4.1
OS                : Windows 10

Environment Variables:

ANDROID_HOME     : C:\android-sdk
HTTP_PROXY       : not set
http_proxy       : not set
HTTPS_PROXY      : not set
https_proxy      : not set
IONIC_HTTP_PROXY : not set
PROXY            : not set
proxy            : not set

Misc:

backend : pro

Posts: 1

Participants: 1

Read full topic

Ion-textarea events

$
0
0

@PatLec wrote:

I try to resize textarea when it reset so try fire function when it reset.
I have try with ‘reset’ and ‘ionReset’ but neither works.
extract of my code:
@HostListener(‘input’, [’$event.target’])
onInput(textArea:HTMLTextAreaElement):void {
this.adjust();
}

@HostListener(‘ionBlur’, [’$event.target’])
onBlur(textArea:HTMLTextAreaElement):void {
this.adjust();
}

@HostListener(‘ionReset’, [’$event.target’])
onResest(textArea:HTMLTextAreaElement):void {
this.adjust();
}

both onInput and onBlur are fired but not onReset

Posts: 1

Participants: 1

Read full topic

I wanna create video chat app for ionic-v3

Uncaught (in promise) TypeError: cannot read property '0' of undefined

$
0
0

@carvear wrote:

Hello i am trying to access the values of a JSON. I need to fill the array items with the result of getDataProductosInfinite(). I know that productosInfinite has all the values, but when i try to access to the first value this.items.push( this.productosInfinite[0] ) it says "uncaught (in promise)… " How can i solve this?

Thanks!

My home.html:
<ion-content>
<ion-list> <ion-item *ngFor=“let i of items”>{{i}}</ion-item> </ion-list> <ion-infinite-scroll (ionInfinite)=“doInfinite($event)”> <ion-infinite-scroll-content></ion-infinite-scroll-content> </ion-infinite-scroll>
</ion-content>

My home.ts:

import { Component } from ‘@angular/core’;
import { NavController, Slides} from ‘ionic-angular’;
import { Http } from ‘@angular/http’;

@Component({
selector: ‘page-home’,
templateUrl: ‘home.html’
})
export class HomePage {
productosInfinite:any;
items = ;

constructor(public navCtrl: NavController, public http: Http) {
for (let i = 0; i < 30; i++) {
this.items.push( this.productosInfinite[0] );
}
}

ionViewDidLoad(){
this.getDataProductosInfinite();
}

getDataProductosInfinite(){
this.http.get(“URL where i get the JSON”).subscribe( data => {
this.productosInfinite = JSON.parse(data["_body"]);
}, err =>{
console.log(err);
});
}

doInfinite(infiniteScroll) {
setTimeout(() => {
for (let i = 0; i < 30; i++) {
this.items.push(this.productosInfinite[0]);
}

  infiniteScroll.complete();
}, 500);

}
}

The JSON I get
[{“productoTitulo”:“Bacardi Mojito”,“productoPrecioHoy”:“80”,“imagenArchivo”:“producto1.jpg”},{“productoTitulo”:“Cinderella”,“productoPrecioHoy”:“100”,“imagenArchivo”:“producto2.jpg”},{“productoTitulo”:“Orange Spritz”,“productoPrecioHoy”:“110”,“imagenArchivo”:“producto3.jpg”},{“productoTitulo”:“American Breakfast”,“productoPrecioHoy”:“210”,“imagenArchivo”:“producto4.jpg”},{“productoTitulo”:“Johnny B. Good Special”,“productoPrecioHoy”:“200”,“imagenArchivo”:“producto5.jpg”},{“productoTitulo”:“Countryside Breakfast”,“productoPrecioHoy”:“230”,“imagenArchivo”:“producto6.jpg”},{“productoTitulo”:“BBQ Ribs”,“productoPrecioHoy”:“100”,“imagenArchivo”:“producto7.jpg”},{“productoTitulo”:“Rib Eye Stick”,“productoPrecioHoy”:“180”,“imagenArchivo”:“producto8.jpg”},{“productoTitulo”:“Mac And Cheese”,“productoPrecioHoy”:“130”,“imagenArchivo”:“producto9.jpg”},{“productoTitulo”:“Caesars Salad”,“productoPrecioHoy”:“180”,“imagenArchivo”:“producto10.jpg”},{“productoTitulo”:“Top Hip Combo”,“productoPrecioHoy”:“140”,“imagenArchivo”:“producto11.jpg”}]

Posts: 1

Participants: 1

Read full topic

Remove SideMenu on Logout

$
0
0

@umsuka wrote:

Hi Guys

I need assistance with removing a sidemenu once user has logged out and redirected to the login screen.

Posts: 1

Participants: 1

Read full topic

Show white screen when app run first time

$
0
0

@hello123 wrote:

Hii every one,
I have a “problem” with my app for android platform. When it’s running first time,a white screen appears for about 5/6 seconds,then run splash page.
How is it possible to avoid this white screen?

using ionic 2

ionic (Ionic CLI) : 4.2.1 (/usr/lib/node_modules/ionic)
Ionic Framework : ionic-angular 3.9.2
@ionic/app-scripts : 3.1.2

Cordova:

cordova (Cordova CLI) : 8.0.0
Cordova Platforms : android 6.4.0, browser 5.0.4
Cordova Plugins : cordova-plugin-ionic-webview 1.1.1, (and 26 other plugins)

System:

Android SDK Tools : 26.1.1 (/home/whitelotus/Android/Sdk)
NodeJS : v10.11.0 (/usr/bin/node)
npm : 4.6.1
OS : Linux 4.15
show tools which i have use.

Posts: 1

Participants: 1

Read full topic

Ionic check number

$
0
0

@darrenM96 wrote:

Hi, i’m new to ionic and trying to validate if a user has entered the correct number. I have structured it in a form. They are asked to remember a number, if it is correct they should be shown a message to say if its correct or not.
Ive followed a tutorial video to get this far but Im unable to check if its a number as the tutorial checked it the field was empty.
thanks in advance.

test.html


<ion-header>

  <ion-navbar>
  	 <button ion-button menuToggle>
      <ion-icon name="menu"></ion-icon>
    </button>
  		<ion-title>Memory Test</ion-title>
  </ion-navbar>

</ion-header>


<ion-content padding>

  <button ion-button (click)="NumberTechniques()">Memory Techniques</button>
<p> Are you able to remember phone numbers?</p> 
 <p>Try to memorise the following number:</p>
 


<button ion-button (click)="show_input()" >Show/Hide number</button>
<div *ngIf="show">
 <h5> 19161945</h5>

  </div>
<div>
		<p> Enter the phone number you memorised:</p>

</div>



<form [formGroup]="formgroup">
  <ion-list>
    <ion-item>
      <ion-label floating>
        First Number
      </ion-label>
      <ion-input type="text" formControlName="memnumber" ></ion-input>
    </ion-item>

    <ion-item *ngIf="memnumber != '19161945'" >
    <p>Number is correct</p>
    </ion-item>
  <button  clear ion-button>Check</button>
  </ion-list>




</form>

test.ts

import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import { Answer } from "../../models/answer";
import { FormBuilder, FormGroup, Validators, AbstractControl } from '@angular/forms';
import { Test1Page } from '../test1/test1';


@IonicPage()
@Component({
  selector: 'page-test',
  templateUrl: 'test.html',
})
export class TestPage {
	answer = {} as Answer;
  formgroup:FormGroup;
  memnumber:AbstractControl;
  phonenumber:AbstractControl;
  

  constructor(public navCtrl: NavController, public navParams: NavParams, public formbuilder:FormBuilder) {


    this.formgroup = formbuilder.group({
      memnumber:[ '',Validators.required],
      phonenumber:[ '',Validators.required]
    });

    this.memnumber = this.formgroup.controls['memnumber'];
    this.phonenumber = this.formgroup.controls['phonenumber'];
  }
NumberTechniques()
  {
    this.navCtrl.push(Test1Page); 
     }


show_input() {
  //this.show = true;
if(this.show == true){
  this.show = false;
  }
  else
  {
  this.show = true;
  }
}

show_input1() {
  //this.show = true;
if(this.show1 == true){
  this.show1 = false;
  }
  else
  {
  this.show1 = true;
  }
}

  ionViewDidLoad() {
    console.log('ionViewDidLoad TestPage');
  }


}

Posts: 1

Participants: 1

Read full topic


XMLHttpRequest doesn´t work as wished

$
0
0

@Josef87 wrote:

i have a sensor on raspberry. it read data and save it on a file on our xampp server (should stay xampp, cause we just use it in office). Now i wanna read the data from the file and get it into my app. For first test i just saved a file "hallo.txt in the same directory. I tried on that way:

data.ts:

loadDoc() {
    var xhttp = new XMLHttpRequest();
    xhttp.onreadystatechange = function() {
      if (this.readyState == 4 && this.status == 200) {
        document.getElementById("xPos").innerHTML = this.responseText;
      }
    };
    xhttp.open("GET", "hallo.txt", true);
    xhttp.send();
  }

and data.html:

<!--Position X now-->
        <div id="xPos" class="lrDataBox lrDataBox-1" style="text-align: right">{{ global.xPos }} m</div>


        <button ion-button (click)="loadDoc()">click</button>

when i click the Button, the {{ global.xPos }} get away and the area is just blank. The same happened, when i deleted the “hallo.txt”. So I think it just don´t read from the file. When i change the “hallo.txt” to the url on my xampp server (“http://190.168.xxx.xxx/test/myfile.txt”) nothing works anymore. Just the global.xPos stays into the area.

How can I make it work?

Posts: 1

Participants: 1

Read full topic

How to remove history from stack in Ionic 4

$
0
0

@thiagoit wrote:

Hi everyone!

I’m working in a project Ionic/Angular and I need to remove the last router from stack when I press the hardware back button, however, I can’t find a way to do this. I noticed that in Ionic 3 there were some methods used to remove some pages from stack. I don’t want if I press back button it goes back to registration data page.

Is there a way to do that in Ionic 4?

Posts: 1

Participants: 1

Read full topic

Rxjs error

$
0
0

@LouisR wrote:

Hi

I am using RXJS in my ionic 3 app. I deleted the node_modules directory and resinstalled all dependencies (this project is using yarn), and now I get this error:

__WEBPACK_IMPORTED_MODULE_1_rxjs_Observable__.Observable.combineLatest is not a function

image

Posts: 1

Participants: 1

Read full topic

Ion-range dualknow with problem in chrome

$
0
0

@Marclfv wrote:

I’m having a problem with dual-ion ion-range where the problem is visible only in chrome.

Problem is visible in version 3 and 4beta


IE and firefox the problem does not happen.

Have you found anything like it?

example:
Screenshot_5
Screenshot_6

Posts: 1

Participants: 1

Read full topic

Ionic 3: camera preview takePicture() is not respecting y-axis restrictions (but works fine along x-axis)

$
0
0

@sandeepku wrote:

I want to open camera preview inside a containing div, which is a rectangle and take picture of whatever is visible inside the camera preview.

I used CameraPreview.startCamera method (see method below) to give startCamera exact rectangle to open camera. And it works fine and open camera in the div exactly as I wanted.

But when I take picture (see below: cameraPreview.takePicture ), I see that camera has captured the content outside of given rectangle along Y-axis .

Interestingly, along X-axis picture only has content which was inside the rectagle at the time of taking picture, as expected.

I am attaching my the relevent picture and the code below.

I am attaching two pictures and my code.

Any help will be greatly appreciated!


**Image 1 below: camera preview inside containing div.**


**Image 2 below: Actual image taken by camera preview and what was I actually expecting:**


I use the following code to open camera in preview and take the picture:

export class CameraService {
    constructor(private camera: Camera,
                private platform: Platform,
                private cameraPreview: CameraPreview) {

    }

    takePicture(div) {
        return this.cameraPreview.takePicture();
    }

    startCamera(div?) {

        let rectangle = div.getBoundingClientRect();
        let x = rectangle.x;
        let y = rectangle.y;
        let width = rectangle.width;
        let height = rectangle.height;
        let tapEnabled: any = false;
        let dragEnabled: any = false;
        // let toBack: any = true;
        let alpha = 1;
        let rect: any = {
            x: x || 250,
            y: y || 250,
            width: width || this.platform.width(),
            height: height || this.platform.height()
        };

        console.log(rect);

        this.cameraPreview.startCamera(
            {
                ...rect,
                toBack: true,
                tapEnabled,
                dragEnabled,
                previewDrag: true,
                alpha
            }
        );
    }
}

Posts: 1

Participants: 1

Read full topic

Ionic v3 content in ion-content wont scroll only on Android (scrolls fine in ios)

$
0
0

@drkhannah wrote:

Ionic:

ionic (Ionic CLI) : 4.5.0 (/usr/local/lib/node_modules/ionic)
Ionic Framework : ionic-angular 3.9.2
@ionic/app-scripts : 3.2.0

Cordova:

cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
Cordova Platforms : android 7.1.4, ios 4.5.5
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 2.3.1, (and 9 other plugins)

System:

Android SDK Tools : 26.1.1 (/Users/Derek/Library/Android/sdk)
ios-deploy : 1.9.4
NodeJS : v11.0.0 (/usr/local/Cellar/node/11.0.0/bin/node)
npm : 6.4.1
OS : macOS Mojave
Xcode : Xcode 10.1 Build version 10B61

Posts: 3

Participants: 1

Read full topic

[Ionic 4.0.0-rc] Custom Fonts returning 404

$
0
0

@eduardoshtfuj wrote:

Hi everyone!

After I updated my Ionic project to version 4.0.0-rc, I getting 404 from my custom font, and I can’t make it work.

Someone is having this problem?

In Github Releases I was looking for something changed about css, but aparently dont have.

Posts: 1

Participants: 1

Read full topic


Ionic app wont load in IOS simulator (The App Server is not running)

$
0
0

@owna wrote:

Hi Guys,

I am currently working on an Ionic 3 project, this project builds and works fine on IOS devices and Android Device, however when I use any IOS simulator using xCode or using the Ionic emulate command, I get the error below.

I have tried to run prod builds, removed IOS and added again, I have enabled COREs on my server etc, and search the net but nothing seems to come up!


Ionic:

ionic (Ionic CLI) : 4.2.1 (/usr/local/lib/node_modules/ionic)
Ionic Framework : ionic-angular 3.9.2
@ionic/app-scripts : 3.2.1

Cordova:

cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
Cordova Platforms : android 7.1.4, browser 5.0.4, ios 4.5.5
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 2.2.1, (and 8 other plugins)

System:

Android SDK Tools : 26.1.1 (/Users/billy/Library/Android/sdk)
ios-deploy : 2.0.0
NodeJS : v8.9.1 (/usr/local/bin/node)
npm : 6.4.1
OS : macOS
Xcode : Xcode 10.1 Build version 10B61

Posts: 1

Participants: 1

Read full topic

Cordova-plugin-firebase causing -- Plugin with id 'com.google.gms.google-services' not found

$
0
0

@helpmelearn wrote:

In trying to get android adaptive icons to work, it was suggested to remove the platform and add android again.
I did this, but now I get this error

  • What went wrong:
    A problem occurred evaluating root project ‘android’.

Plugin with id ‘com.google.gms.google-services’ not found.

I have been able to build before just fine.

The cordova-plugin-firebase plugin seems to be the problem. The gradle it creates has this.

buildscript {

    repositories {

        jcenter()

        mavenCentral()

    }

    dependencies {

        classpath 'com.android.tools.build:gradle:+'

        classpath 'com.google.gms:google-services:4.1.0'

    }

}

repositories {

    mavenCentral()

    maven {

        url "https://maven.google.com"

    }

}



dependencies {

    compile 'me.leolin:ShortcutBadger:1.1.4@aar'

    compile 'com.google.firebase:firebase-auth:+'

    compile('com.crashlytics.sdk.android:crashlytics:2.9.1@aar') {

       transitive = true

    }

}



cdvPluginPostBuildExtras.add({

    apply plugin: 'com.google.gms.google-services'

})

This matches all our other apps that build just fine.
Do I need to set something up again for cordova-plugin-firebase???

Posts: 1

Participants: 1

Read full topic

Playing local audio files (files saved into sdcard)

$
0
0

@garalimedkarim wrote:

I’m creating a big Application for audio play & download,
I read files in streaming (‘https://anysite/track0.mp3’) => It Works,
But When I download files, I can’t read them from SD Card, I verified my Android Files, the file exist but I couldn’t read it with the audio player in my App.

I’ve tried 3 paths in the constructor:

#home.ts

export class HomePage {
  path;
  internalURL;
  URL;
  

  constructor(public navCtrl: NavController, 
          private file: File) {
  this.path = this.file.externalRootDirectory+"AwesomePlaces/track0.mp3";
  this.file.resolveLocalFilesystemUrl(this.path)
  .then(fileEntry =>{
    this.internalURL = fileEntry.toInternalURL();
    this.URL = fileEntry.toURL();
  })

outputting this 3 paths:

path & URL output the same result:

file:///storage/emulated/0/AwesomePlaces/track0.mp3

internalUrl outputs

cdvfile://localhost/sdcard/AwesomePlaces/track0.mp3

But no one of those path works with audio player neither with audio-player Cordova Plugin which is based on HTML5 audio player.

#home.html

<audio controls controlsList="nodownload" style="width: 100%">
    <source src="{{pathToTry}}" type="audio/mpeg">
    Your browser does not support the audio element.
</audio>

Only the “https://anysite/track0.mp3” worked for me

I’m asking about a solution to play my sdcard audio files in Android an IOs, And with a progress line So the user can change manually the playing timing but clicking on the progress line. so for this reason I didn’t work with Media Native plugin which doesn’t provide me with the progress line.

Note:

When I use Media Plugin with my “path” it works:

this.audio = this.media.create(this.path);
this.audio.play(); // it plays 

Does Any One Have Any Idea ?

Posts: 1

Participants: 1

Read full topic

Android application not working

$
0
0

@enniob wrote:

I just made a new application using ionic start myApp tabs --type=angular when I run the application using ionic server it works fine in the browser and I can see the start application.

I uploaded the app to my appflow and created a native Android app. When I upload to my tablet the application does not work and all I see is a white screen.

I’m using an Android tablet (Model number rk3288 and running Android 6.0.1).

Also here is the ionic info


   ionic (Ionic CLI)             : 4.6.0 
   Ionic Framework               : @ionic/angular 4.0.0-rc.0
   @angular-devkit/build-angular : 0.11.4
   @angular-devkit/schematics    : 7.1.4
   @angular/cli                  : 7.1.4
   @ionic/angular-toolkit        : 1.2.1

Cordova:

   cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
   Cordova Platforms     : android 6.4.0
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 2.3.1, (and 4 other plugins)

System:

   NodeJS : v10.13.0 (C:\Program Files\nodejs\node.exe)
   npm    : 6.4.1
   OS     : Windows 10

Any idea how I can get the app to work?

Posts: 2

Participants: 2

Read full topic

How to choose multipal files using file chooser plugin

$
0
0

@Swaychal wrote:

how to choose multipal files using fillechooser plugin currently it choose only one file

chooseFile() {
this.fileChooser.open()

   .then((uri) => {
       
        this.filePath.resolveNativePath(uri)
            .then(results => {
                console.log(results);
        this._progressDialog.presentLoading();
        var imageName = results.substr(results.lastIndexOf('/') + 1);
        console.log("Choosen file path: "+results);
        console.log("Choosen file name: "+imageName);

Posts: 1

Participants: 1

Read full topic

Viewing all 48984 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>