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

IonSlides (ionSlideTap) event firing twice on iPad

$
0
0

@thetimmo wrote:

I’m experiencing an issue which seems to only be happening on iPad (both in Safari and in Capacitor app) but not iPhone or web browsers.

I’m wondering if anyone can replicate the issue and help me determine whether it’s a problem with my setup or not.

When creating a new app using ionic start sliderApp tabs --capacitor and adding ion-slides code below, the ionSlideTap event is firing twice. I also have zoom.toggle configured to true (to allow for double tap zooming) but I’m seeing this zoom occur on a single tap rather than the expected double tap for this. Whilst looking into it I found the singleTap even was firing twice.

If anyone could replicate or has an suggestions for a work around it would be very much appreciated.

thanks

Code below.

  <ion-slides [options]="sliderOptions" (ionSlideTap)="tapped($event);">
    <ion-slide>
      <div class="swiper-zoom-container">
        <img src="https://upload.wikimedia.org/wikipedia/commons/e/e1/P.S._Kr%C3%B8yer%2C_Et_m%C3%B8de_i_Videnskabernes_Selskab%2C_1897%2C_Det_Kongelige_Danske_Videnskaberners_Selskab.jpg"/>
      </div>
    </ion-slide>
    <ion-slide>
      <div class="swiper-zoom-container">
        <img src="https://upload.wikimedia.org/wikipedia/commons/e/e1/P.S._Kr%C3%B8yer%2C_Et_m%C3%B8de_i_Videnskabernes_Selskab%2C_1897%2C_Det_Kongelige_Danske_Videnskaberners_Selskab.jpg"/>
      </div>
    </ion-slide>
    <ion-slide>
      <div class="swiper-zoom-container">
        <img src="https://upload.wikimedia.org/wikipedia/commons/e/e1/P.S._Kr%C3%B8yer%2C_Et_m%C3%B8de_i_Videnskabernes_Selskab%2C_1897%2C_Det_Kongelige_Danske_Videnskaberners_Selskab.jpg"/>
      </div>
    </ion-slide>
  </ion-slides>
  sliderOptions = {
    zoom: {
      toggle: true,
      maxRatio: 3,
      //containerClass: "swiper-zoom-container"
    }
  };

Posts: 1

Participants: 1

Read full topic


Cordova not available on real device

$
0
0

@rajmd wrote:

getting cordova not available error with livereload on real device

ionic cordova run android -l

ionic info

Ionic:

Ionic CLI : 5.4.16 (C:\Users\rajmohan\AppData\Roaming\npm\node_modules\ionic)
Ionic Framework : @ionic/angular 5.0.0
@angular-devkit/build-angular : 0.900.5
@angular-devkit/schematics : 9.0.5
@angular/cli : 9.0.5
@ionic/angular-toolkit : 2.1.2

Cordova:

Cordova CLI : 9.0.0 (cordova-lib@9.0.1)
Cordova Platforms : android 8.1.0, browser 6.0.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.1.3, (and 7 other plugins)

Utility:

cordova-res (update available: 0.10.0) : 0.9.0
native-run : 0.3.0

System:

Android SDK Tools : 26.1.1 (C:\Users\rajmohan\AppData\Local\Android\Sdk)
NodeJS : v10.15.0 (C:\Program Files\nodejs\node.exe)
npm : 6.14.2
OS : Windows 10

Posts: 1

Participants: 1

Read full topic

Android app loading fine in browser, failing to launch in emulator

$
0
0

@sqageekz wrote:

Hi,
I am beginner to the Android development. I am trying to develop an app in Android. I face problems with dependencies while integrating firebase. In stackoverflow, they suggested me to upgrade to AndroidX to solve the dependency issues. I did the same. After that, my app not working in emulator. It is working fine in browser. But, in app, after splash screen displayed, it is crashing. How can I figure out what was the problem & how to solve it?

Posts: 1

Participants: 1

Read full topic

Ios can't connect to server

$
0
0

@ctfrancia wrote:

cross post. So the problem is that:
$ ionic cordova prepare ios

$ ionic cordova run ios -l --external

the ios device will connect to the server, however,

$ ionic cordova prepare ios

$ ionic cordova run ios --device

it fails with the error Failed to load resource: A server with the specified hostname could not be found I’ve been reading a lot of the other posts but none of them has solved it for me:
even:

$ ionic cordova prepare ios

$ ionic cordova build ios

$ ionic cordova run ios --device

same error. Launching it from xcode has the same issue. I have been working on this for 2 days now and suicide at this point doesn’t seem like a bad option. god I hate ios.

Posts: 1

Participants: 1

Read full topic

Upload image to an API as binary data

$
0
0

@prasanna-j wrote:

Hi,

I need to send the image as binary data to an external API as shown in the screenshot. It works fine with Postman. But, I’m having trouble implementing this in Ionic. I tried reading the file contents as binary data using readAsBinaryString() and passing the result as body of the HTTP request. It didn’t work. Please help with the code sample.

Posts: 1

Participants: 1

Read full topic

Read binary file located in project directory using @ionic/react-hooks/filesystem

$
0
0

@vahid18u wrote:

Hi guys. I want to read a docx file inside my src in runtime. this is my function:

const loadTemplate = async (readFile) => {
  try {
    let contents = await readFile({
      path: "./template.docx",
      directory: FilesystemDirectory.Data
      //encoding: FilesystemEncoding.UTF8
    });
    console.log(contents);
    return contents;
  } catch (e) {
    throw e;
  }
};

readFile function is destructed from useFilesystem() destructed from ‘@ionic/react-hooks/filesystem’.
it says Error: File does not exist.
How can I open binary file located in my project?

Posts: 1

Participants: 1

Read full topic

Need an opinion to Angular-Resolver and Ionic

$
0
0

@Catweazle101 wrote:

Hi all,

We all know the the resolver feature of Angular to fetch some data before you navigate to a different route.
I tested this feature in my Ionic application.

But so far I saw, when I navigate forward in Ionic the pages are stacked one on top of the other.
But when I navigate back it just removes the last page from the top of the pages stack and shows the page below again (page is already created…ngOnInit is not executed again)

But also the resolver is executed again and fetches the data again even no data has changed.
Can I suppress the resolver anyhow when I navigate to a page?

Am I on the wrong path?
Or is it in general not a good idea to use resolvers with Ionic?

Thanks for every feedback.

Regards,
Oliver

Posts: 1

Participants: 1

Read full topic

Navigation url changes but view does not load

$
0
0

@yahwehown wrote:

I’ve recently switched from a split panel to ion tabs. The tabs works fine but accessing the sub routes is very difficult. The routes are in dashboard.module.ts below

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { Routes, RouterModule } from '@angular/router';
import {DashboardPage} from './dashboard.page';
import {HomePage } from 'src/app/dashboardComponents/home/home.page';
import {JobCenterPage} from 'src/app/dashboardComponents/job-center/job-center.page';
import {SettingsPage} from 'src/app/dashboardComponents/settings/settings.page';
import {ProfileEditPage } from 'src/app/dashboardComponents/profile-edit/profile-edit.page';
import {PostedJPage } from 'src/app/dashboardComponents/posted-j/posted-j.page';
import { AppliedJobsPage} from 'src/app/dashboardComponents/applied-jobs/applied-jobs.page';
import { JobCompletedPage } from 'src/app/dashboardComponents/job-completed/job-completed.page';
import { ApplicantsPage} from 'src/app/dashboardComponents/applicants/applicants.page'
import { IonicModule } from '@ionic/angular';

const routes: Routes = [
  {
    path:'dashboard',
    component:DashboardPage,
    children: [
      {
        path: "home",
        component: HomePage
      },
      {
        path: "job-center",
        component: JobCenterPage,
        children:[
          {
            path:"posted",
            loadChildren: 'src/app/dashboardComponents/posted-j/posted-j.module#PostedJPageModule'
          },
          {
            path:"applied-jobs",
            component:AppliedJobsPage
          },
          {
            path:"job-completed",
            component:JobCompletedPage
          },
          {
            path:"applicants",
            component:ApplicantsPage
          },

]
      },
      {
        path: "profile-edit",
        component: ProfileEditPage
      },
      {
        path: "settings",
        component: SettingsPage
      }
    ]
  }
]

@NgModule({
  imports: [
    CommonModule,
    FormsModule,
    IonicModule,
    RouterModule.forChild(routes)
  ],
  declarations: []
})
export class DashboardPageModule {}

I am trying to access the child routes of job center and the url changes but the page does not load.

job-center.page.html

<ion-header>
  <ion-toolbar>
    <ion-title>Job Center</ion-title>
  </ion-toolbar>
  </ion-header>
<ion-content>
  <ion-list>
    <ion-item lines="full" (click)="toPosted()" >
      <ion-icon name="list-box"></ion-icon>
      <ion-label>Posted Jobs</ion-label>
      <ion-badge color="primary">{{postedJobs}}</ion-badge>
    </ion-item>
    <ion-item lines="full" (click)="toApplied()">
      <ion-icon name="checkmark-circle"></ion-icon>
      <ion-label>Jobs Applied</ion-label>
      <ion-badge color="primary">{{appliedJobs}}</ion-badge>
    </ion-item>
    <ion-item lines="full" (click)="toJobCompleted()">
      <ion-icon name="checkmark"></ion-icon>
      <ion-label>Completed Jobs</ion-label>
      <ion-badge color="primary">{{completedJobs}}</ion-badge>
    </ion-item>
    <ion-item lines="full" (click)="toApplicants()" >
      <ion-icon name="done-all"></ion-icon>
      <ion-label>Applicants</ion-label>
      <ion-badge color="primary">{{applicants}}</ion-badge>
    </ion-item>
  </ion-list>
</ion-content>

job-center.page.ts

import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { Storage } from '@ionic/storage';
import { DataService } from 'src/app/data.service';
@Component({
  selector: 'app-job-center',
  templateUrl: './job-center.page.html',
  styleUrls: ['./job-center.page.scss'],
})
export class JobCenterPage implements OnInit {

  constructor(private router: Router,public storage: Storage,
  public _data: DataService) { }
 userData;
 postedJobs;
 completedJobs;
 appliedJobs;
 applicants;
 dataLengths;

  ngOnInit() {

  }

  ionViewWillEnter(){
        this.userData = this.storage.get('user');
        this.storage.get('user').then((value)=>{
          this.userData = value;
          this._data.getCurrentUser(this.userData._id)
          .subscribe(
            res=>(
            this.dataLengths = res,
            this.completedJobs = this.dataLengths.completedJobs.length,
            this.appliedJobs= this.dataLengths.appliedJobs.length,
            this.postedJobs = this.dataLengths.postedJobs.length,
            this.applicants = this.dataLengths.applicants.length
            ),
            err=> console.log(err)
          )
        })
  }

  toApplied(){
    this.router.navigate(['dashboard/job-center/applied-jobs'])
  }

  toJobCompleted(){
    this.router.navigate(['dashboard/job-center/job-completed'])
  }

  toPosted(){
    this.router.navigate(['dashboard/job-center/posted'])
  }

  toApplicants(){
    this.router.navigate(['dashboard/job-center/applicants'])
  }
}

The tab has four links and job center is one of them. Job center also has an item list with click events to navigate to the sub routes on job center but it does not work. The url changes but the pages do not load.
Please help

Posts: 1

Participants: 1

Read full topic


Ionic React css background url -- schema-utils

$
0
0

@appaulmac wrote:

As soon as I added css to style the background of an element with an image:

background: #164C77 url(../images/earth_bg.png) no-repeat 0 0;

I now receive the error ‘Failed to compile’:

Error: Cannot find module 'schema-utils'

I subsequently installed the npm module but nothing has changed. Is there a way I have to include this in my files (other than package.json) to make use of the url property of css?

Posts: 1

Participants: 1

Read full topic

Ionic with offline use and data-driven architecture

$
0
0

@pliniosantos wrote:

I’m reseaching tecnologies to develop a solution for the following use cases:

  • A user goes to a construcion site in where probably there is no internet connection. There the user the take some photos e and notes using an application;
  • He can do such offline work using a phone or a laptop;
  • Back in the office, where there is internet connection, the offline collected information is synced to services and made available to all other users.
    In your experience, this requirements are reacheble with Ionic?
    At first glance, I’m planning to use ionic/angular/capacitor to build PWA and Android apps. Desktop is in later milestone. Initially iOS users would have access using PWA.
    Other question: Ionic’s offline storage are paid? It’s a bit confusing to me whether its possible to use it with no cost at all - of course, alwo with no support at all.

Posts: 1

Participants: 1

Read full topic

Mutating @Input object in child component

$
0
0

@maid wrote:

Hello everyone. This might not be a good place to ask Angular specific questions. if I violate rules, please let me know so I could delete this topic.

Is it okay to mutate @Input object in child component which is sent from the parent? This way we don’t need to notify parent when we change some property as this JS object will reflect to parent automatically. If it’s not a good practice, can You please provide me a reason for this.

Thanks.

Posts: 1

Participants: 1

Read full topic

Capacitor-android projectDir default path change in latest version

$
0
0

@peterkhang69 wrote:

Is there any reason to move capacitor plugin folder from android/cpacitor to …/node_modules/@capacitor/android/capacitor ?

We don’t commit node_modules to git repository : So my custom change of capacitor plugins sources are
removed after redo the command “npm i”.

I can resolve this issue by modifying capacitor.settings.gradle but
Please inform me the reason If ionic team has a special intension.

Best regards,
from Peter Khang.

Posts: 1

Participants: 1

Read full topic

Popover-like Thing

$
0
0

@vicatcu wrote:

I want something like a popover, but that doesn’t modal-ly take over the background, so that I can still scroll content in the background and select / copy / paste from the background without dismissing it. Anyone got any pointers?

Posts: 1

Participants: 1

Read full topic

Unable to add 'title' to AlertController in Ionic 6 app

$
0
0

@Sweg wrote:

I am trying to add an AlertController to my Ionic 6 app with the below code:

presentAlert() {
  let alert = this.alertCtrl.create({
    title: 'Low battery',
    subTitle: '10% of battery remaining',
    buttons: ['Dismiss']
  });
  alert.present();
}

However, my IDE is throwing this error message under title: 'Low battery':

Argument of type ‘{ title: string; subTitle: string; buttons: {}; }’ is not assignable to parameter of type ‘AlertOptions’.
Object literal may only specify known properties, and ‘title’ does not exist in type ‘AlertOptions’.

I am copying this code from the ionic documentation, so I don’t know why it’s throwing an error. Can someone please tell me why this is, & how it can be resolved?

Posts: 2

Participants: 2

Read full topic

Stripe checkout form disappeared from publishing


Popover dissmiss anywhere another component

$
0
0

@sudhaHalemani wrote:

Hi here i’m try to call the popover in details component.
using popover i’m displaying the users.but invalid users
i need to show toasts and i should stop dissmiss the popover.
but this validation method is called from service component so i needed to stop the popover dissmiss from service component only . how could i do it. plz help out here.

Posts: 1

Participants: 1

Read full topic

Ionic3 issue with ios 13.3.1

$
0
0

@nithin2020 wrote:

I am using “ionic-angular”: “3.9.2” which was working fine for web, android and ios. But after the update of ios 13.3.1 version, I could not login to my ios app and this app works fine for all ios devices with ios versions less than 13.3.1.

Also, this app has uploaded to app-store and no issues on taking ios cordova builds or running on other ios devices with ios version other than 13.3.1.

Found a comment on this issue => https://community.fitbit.com/t5/iOS-App/Ionic-will-not-sync-with-iOS-13-3-1/td-p/4119084#

Has anyone got the same issue. Is there any solution for this issue.

Posts: 1

Participants: 1

Read full topic

V4 SCSS within ionic/core should not be imported

$
0
0

@john33john33 wrote:

goal: use app level background color in custom component

if import scss, e.g. @import “~@ionic/core/dist/collection/themes/ionic.theme.default.scss”;
compiler prompt: “[DEPRECATED] SCSS within ionic/core should not be imported. Next major release will remove all scss support.”
Q: why is that? for what purpose?
I can see the message but I do not understand reason behind.

for “rgb($background-color-rgb-value)”,
error: $channels must be a space-separated list.
That is something I don’t know how to fix

many thanks

Posts: 1

Participants: 1

Read full topic

Ionic Creator - Reorder list items persisting in firebase?

$
0
0

@Solhart wrote:

Hi, folks. This is my first time asking a question like this, so I’m hoping I can provide as much info as I can, but if there’s something confusing, please let me know and I’ll try to clarify it.

I’m using Ionic Creator to create a todo list of sorts using firebase and right now, I’m trying to implement a reorder function. I’ve been able to reorder the items with no issue, but the new reordered list never seems to save the new order or persist. I understand, after looking into it, that I need to find a way to make the reordered items persist in storage, but I’m not quite sure how.

I’ll post some code below and I hope it helps provide some insight. Again, this is my first time asking a question like this, so if there’s something obvious I’m missing, I would appreciate the feedback.

If it may also help, I followed these guides for reference for creating my app, if that may assist with providing any insight at all.


main home page

function ($scope, $stateParams, Todos, $ionicModal) {
    
    $scope.showReorder = false;
    
    $scope.toggle = function(v){
        $scope[v] = !$scope[v];
    }
    
    $scope.reorder = function(item, fromIndex, toIndex){
        $scope.items.splice(fromIndex, 1);
        $scope.items.splice(toIndex, 0, item);
    }
    
    $scope.items = Todos.items;
    
    $scope.data = {
        'title': ''
    }
    
    $scope.modal = $ionicModal.fromTemplate("<ion-modal-view>" +
    "<ion-header-bar class='bar-balanced'>" +
      "<h1 class='title'>Add a Movie Title</h1>" +
      '<button class="button button-clear" ng-click="closeModal()">Close</button>' +
    "</ion-header-bar>" +
    "<ion-content class='padding'>" +
      "<label class='item item-input'><input type='text' placeholder='Title' ng-model='data.title' /></label>" +
      "<button ng-click='addItem()' class='button button-balanced button-block'>Submit</button>" +
    "</ion-content>" +
  "</ion-modal-view>", {
        scope: $scope,
        animation: 'slide-in-up'
    })
    
    $scope.showModal = function(){
        $scope.modal.show();
    }
    
    $scope.closeModal = function(){
        $scope.data.title = '';
        $scope.modal.hide();
    }
    
    $scope.addItem = function(){
        Todos.addItem($scope.data.title);
        $scope.closeModal();   
    }

}

todos.js

angular.module('todos', ['firebase'])

.run(function(){
    
    // Initialize Firebase
      var config = {
        apiKey: (removed for posting purposes)
        authDomain: (removed for posting purposes)
        databaseURL: (removed for posting purposes)
        storageBucket: (removed for posting purposes)
      };
      firebase.initializeApp(config);
    
})

.service('Todos', ['$firebaseArray', function($firebaseArray){
    
    var ref = firebase.database().ref().child('todos');
    var items = $firebaseArray(ref);
    
    var todos = {
        'items': items,
        addItem: function(title){
            items.$add({
                'title': title,
                'finished': false
            });
        },
        setFinished: function(item, newV){
            item.finished = newV;
            items.$save(item);
        }
    }
    
    return todos;

}]);

Posts: 1

Participants: 1

Read full topic

Updating the view manually results in tags using *ngIf being rendered twice

$
0
0

@jsteffen wrote:

I have to incorporate an older library called DataWedge into an existing Ionic 4 project. It requires the use of the Events, which I know is a recently deprecated interface in Ionic, but is still part of the version I’ve built this solution off of.

When the event occurs, it is triggered by a component nested within the view, but the event must update the entire view. This event happens outside of a typical angular “zone” so I’ve had to resort to a little cheat:

initScanListener(){ 

    this.events.subscribe('data:scan', scanData => { 
      let data = scanData.extras["com.symbol.datawedge.data_string"]
      this.onScanForm.controls.contNum.setValue(data.trim().replace(/\W/g, '').replace(/[^\d.-]/g, ''))
      data ? 
        this.submitRequest(false) : 
        this.presentToast('Data Scan Error', 'dagner')

      // Ugh, this is gross: setTimeout exploits a bug because 
      // ApplicationRef.tick() always returns an error. This re-renders the entire view:
      setTimeout(()=>{},0)
    })

  }

Right there at the bottom is a setTimeout() function that I use to re-render the page.

The problem is this: when I manually re-render the page, several elements in my view’s markup that use *ngIf render twice! This only happens on my device, not in the browser.

Anyone know how this could happen?

Posts: 1

Participants: 1

Read full topic

Viewing all 70428 articles
Browse latest View live


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