Quantcast
Channel: Ionic Forum - Latest posts
Viewing all 228529 articles
Browse latest View live

Basic Validation in Ionic

$
0
0

Thanks VictorNorman,

I rechecked thrice times but found some errors being it is in IONIC 3 version.

Please do handy need code for about basic validation

Regards


What is the recommended way to center ion-menu contents vertically in an Ionic 4 project?

Basic Validation in Ionic

$
0
0

I can’t help with ionic 3. I don’t know about it.

Www folder inside platform folder is not updated

$
0
0

I hope that my answer will help someone else. Delete the www folder in your project and run

ionic build

This will update your folder.

My ionic app suddenly stuck on splash screen before it was running

$
0
0

hi thank-you but when I debug code but not getting any error

Unable to style the active tab in ionic4 angular

$
0
0

Any update on figuring this out?

The proper way to implement Bluetooth background service

$
0
0

Hi guys. We have a bluetooth android project where we have to do a bluetooth scan between certain intervals, (I am using BluethoothLE) and send information to the backend server if the user is near a BLE beacon. This is all working fine, but now i am running into a wall with keeping the service running when the user presses the power button. What is the correct way to implement this kind of functionality? I tried to look into backgroundmode and foreground service but it really didn’t give me a clear picture.

Reason behind using this keyword in ionic

$
0
0

thanks a lot

import { Injectable } from '@angular/core';

export class User {
  id: number;
  name: string;
}

@Injectable({
  providedIn: 'root',
})
export class UserService {

  constructor() { }

  getUsers(): Promise<User[]> {
    return Promise.resolve([
      { id: 1, name: 'Maria' },
      { id: 2, name: 'Alex' },
      { id: 3, name: 'Chuntao' },
      { id: 4, name: 'Béatrice' },
      { id: 5, name: 'Sarah' },
      { id: 6, name: 'Andrés' },
      { id: 7, name: 'Abdul' },
      { id: 8, name: 'Pierre' },
      { id: 9, name: 'Jiao' },
      { id: 10, name: 'Seth' }
    ]);
  }

}

```can you explain me use of User class  in this code 


thanks a lots

Ionic Keyboard Forward Arrow Button

$
0
0

(topic withdrawn by author, will be automatically deleted in 24 hours unless flagged)

Reason behind using this keyword in ionic

$
0
0

You really need to spend some time with some textbooks or online stuff reading about object-oriented programming, objects in javascript, etc.

Ionic 4 - How to check current page is on root or not?

$
0
0

Did you create this project from scratch? If so, it is using Angular’s routing, not like it was done in the old days. You could subscribe to the ActivatedRoute to determine if the current route is equal to the default route.

Ionic 3 network connectivity check how to implement for all pages (components)?

Get the cursor position inside ion-textarea

$
0
0

Thanks for your reply! I’m still confused, however on how I can get the node’s selection. So, in pure JS, I could use the textarea object’s selectionStart function, and this would return the cursor position in the text field. Is there a way to expand on what you have to do this?

Ionic 4 infinite scroll not working

$
0
0
Ionic:

   Ionic CLI                     : 5.2.0 (/usr/local/lib/node_modules/ionic)
   Ionic Framework               : @ionic/angular 4.6.0
   @angular-devkit/build-angular : 0.13.9
   @angular-devkit/schematics    : 7.3.9
   @angular/cli                  : 7.3.9
   @ionic/angular-toolkit        : 1.5.1

Utility:

   cordova-res : 0.2.0 (update available: 0.5.1)
   native-run  : 0.2.0 (update available: 0.2.7)

System:

   NodeJS : v10.15.0 (/usr/local/bin/node)
   npm    : 6.9.0
   OS     : macOS High Sierra

package.json

{
  "name": "Ionic4VirtualInfiniteScrollDemo",
  "version": "0.0.1",
  "author": "Ionic Framework",
  "homepage": "https://ionicframework.com/",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/common": "^7.2.2",
    "@angular/core": "^7.2.2",
    "@angular/forms": "^7.2.2",
    "@angular/http": "^7.2.2",
    "@angular/platform-browser": "^7.2.2",
    "@angular/platform-browser-dynamic": "^7.2.2",
    "@angular/router": "^7.2.2",
    "@ionic-native/core": "^5.0.0",
    "@ionic-native/splash-screen": "^5.0.0",
    "@ionic-native/status-bar": "^5.0.0",
    "@ionic/angular": "^4.1.0",
    "core-js": "^2.5.4",
    "rxjs": "~6.5.1",
    "tslib": "^1.9.0",
    "zone.js": "~0.8.29"
  },
  "devDependencies": {
    "@angular-devkit/architect": "~0.13.8",
    "@angular-devkit/build-angular": "~0.13.8",
    "@angular-devkit/core": "~7.3.8",
    "@angular-devkit/schematics": "~7.3.8",
    "@angular/cli": "~7.3.8",
    "@angular/compiler": "~7.2.2",
    "@angular/compiler-cli": "~7.2.2",
    "@angular/language-service": "~7.2.2",
    "@ionic/angular-toolkit": "~1.5.1",
    "@types/node": "~12.0.0",
    "@types/jasmine": "~2.8.8",
    "@types/jasminewd2": "~2.0.3",
    "codelyzer": "~4.5.0",
    "jasmine-core": "~2.99.1",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~4.1.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.1",
    "karma-jasmine": "~1.1.2",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.4.0",
    "ts-node": "~8.3.0",
    "tslint": "~5.17.0",
    "typescript": "~3.1.6"
  },
  "description": "An Ionic project"
}

home.page.html

<ion-header>
  <ion-toolbar>
    <ion-title>
      Ionic Infinite Scroll
    </ion-title>
  </ion-toolbar>
</ion-header>

<ion-content>
  <div class="ion-padding">

    <ion-list>
      <ion-item *ngFor="let item of items">{{item}}</ion-item>
    </ion-list>

    <ion-infinite-scroll threshold="250px" (ionInfinite)="loadData($event)" [disabled]="numTimesLeft <= 0">
      <ion-infinite-scroll-content
        loadingSpinner="bubbles"
        loadingText="Loading more data...">
      </ion-infinite-scroll-content>
    </ion-infinite-scroll>

  </div>
</ion-content>

home.page.ts

import { Component, ViewChild } from '@angular/core';
import { IonInfiniteScroll } from '@ionic/angular';

@Component({
  selector: 'app-home',
  templateUrl: 'home.page.html',
  styleUrls: ['home.page.scss'],
})
export class HomePage {

  items = [];
  numTimesLeft = 5;

  @ViewChild(IonInfiniteScroll) infiniteScroll: IonInfiniteScroll;

  constructor() {
    this.addMoreItems();
  }

  loadData(event) {
    setTimeout(() => {
      console.log('Done');
      this.addMoreItems();
      this.numTimesLeft -= 1;
      event.target.complete();
    }, 2000);
  }

  addMoreItems() {
    for (let i=0; i<20; i++)
      this.items.push(i);
  }

}

Not working on fresh blank project.
I’ve installed this (exactly the same code)
git clone https://github.com/JamiBot/Ionic-4-Infinite-Scroll-Example.git

And unique difference is “package-lock.json” file

Any idea to make infinite scroll working ?

Get the cursor position inside ion-textarea


Error when subscribing to Screen Orientation changes

$
0
0

Hi @VictorNorman,

I did have the same problem and resolved using “javascript” with handling of event “orientationchange”.

I used into my component.ts

declare var window: any;

ionViewWillEnter() {
   window.addEventListener('orientationchange', _ => {
      console.log('Change orientation.')
   });
}

ionViewWillLeave() {
    window.removeEventListener('orientationchange');
}

i hope that solve your problem too

IONIC 4 : Loading Controller, dismiss() is called before present() which will keep spinner without dismissing

$
0
0

Yes, I understand your problem now. Perhaps if you changed

await this.loader.present();

to just

this.loader.present();

Then it would put the spinner up there but wouldn’t wait before returning control to the caller. I think.

Error when subscribing to Screen Orientation changes

[ionic4] - how to use hardware back button to close loading (when pressed during loading) or to go to previous page or to exit the app

$
0
0

How to use hardware back button to close loading (when it is pressed during loading) or to go to previous page (when the page is not selected from menu) or to exit the app (if the page is selected from menu)…

I was implemented above functionality in ionic 3 (as shown below) how to achieve the same in ionic 4?

constructor(private ionicApp: IonApp) { 

}

this.platform.backButton.subscribe(async () => {	
                let activePortal = this.ionicApp.getActive() || this.ionicApp._modalPortal.getActive() || this.ionicApp._overlayPortal.getActive();
                if (activePortal) {
                    activePortal.dismiss();
                }
                else if (this.nav.canGoBack()) {
                    this.nav.pop();
                } else {
                    let confirm = await this.alertCtrl.create({
                        header: 'Confirm',
                        message: 'Do you want to exit ?',
                        buttons: [
                            {
                                text: 'Cancel', handler: () => { }
                            },
                            {
                                text: 'Ok',
                                handler: () => {
                                    this.platform.exitApp();
                                }
                            }
                        ]
                    });
                    await confirm.present();
                }
            });

Any plans for Ionic Studio for Linux?

$
0
0

Hi. I willing to try Ionic Studio and test if it meets my needs when developing Ionic apps, but forcefully I require a Mac or a Windows computer, and I’m a Linux user.
I know that my “solution” would be something like “Install Windows and try”, or “Test if it works using wine”, but I think that if you already have the Windows and Mac versions, compiling a Linux version shouldn’t be so complicated.

Are there any plans for a Linux version? or anything in the product roadmap that includes Linux in some way?
Thanks.

Viewing all 228529 articles
Browse latest View live


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