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

Ion-checkbox model not updating from ionchange

$
0
0

@tbozdemir wrote:

Hey there!
This is how I create a list with checkboxes to check/uncheck employees. I am binding the checked property of an employee to the checkbox.

<ion-list>
    <ion-item *ngFor="let employee of employees; let i = index">
        <ion-label>{{employee.name}}</ion-label>

        <ion-checkbox  value="{{employee.id}}"  
                                 [(ngModel)]="employee.isChecked"
                                 (ionChange)="emplsChange($event.detail.checked, i)"></ion-checkbox>
    </ion-item>
</ion-list>

However, when the checkbox is changed, I want to check if it can be checked or has to be false. In order to do that, I set the isChecked property of the selected employee to false after I’ve checked the conditions.

    emplsChange(detail: boolean, index: number) {
        const newEmployees: IEmployee[] = this.employees;
        this.employees = [];
        // get all checked employees
        const checkedEmpls = newEmployees.filter(e => e.isChecked).length;
        
        newEmployees[index].isChecked = detail && checkedEmpls === this.needdedEmpls ? false : detail;

        this.employees = newEmployees;
    }

Now, the thing is, that if the condition is true and I set the isChecked to false it works correctly and the checkbox is not checked. But only on the first time. If I check the same employee again the isChecked is set to false but on the UI it is checked.
I’ve tried to solve this by using (ngModelChange) instead of (ionChange) but it did nothing to it.

So the main Problem is, that the UI is not properly updated, when I set the ion-checkbox-Model in the onchange method of the component. Can one of you see another problem? Did someone experienced the same? CaN Som3One plZ HeLp!1!!!11

Thx

Posts: 1

Participants: 1

Read full topic


Scroll to bottom not working

$
0
0

@christopherkock wrote:

Hello!

I have a chat page in my app where the chat-div is inside a wrapper-div. The structure looks like this:

 <ion-content>
 <div class="wrapper>
 <div class="chatwindow">
 <ion-grid>
 <ion-row *ngFor="let message of messages">
 <ion-col *ngIf="message.fromId !== myUid>
 <div class="message other-message>
 <span>{{message.text}}</span>
 </div>
 </ion-col>
 <ion-col *ngIf="message.fromId === myUid>
 <div class="message my-message>
 <span>{{message.text}}</span>
 </div>
 </ion-col>
 </ion-row>
 </ion-grid>
 </div>
 </div
 </ion-content>

My problem is that I am not able to make the chatpage scroll to bottom (both at pageload and when new messages arrives).

What I have tried so far:
TS: file
@ViewChild(‘content’) content: Content;

ngOninit(){
setTimeout(()=>{this.content.scrollToBottom();},200);
}

HTML file:
<ion-content #content>

Above does not give any effect, i also tried using ngZone and [scrollEvents=“true”].
The only thing that has given some effect is [ScrollTop]=“content.scrollheight”. But then the whole chatpage reloades everytime a message arrives and it scroll up and down very fast.

Any help with this will be much appreciated.
Thank you in advance.

Posts: 1

Participants: 1

Read full topic

Polyfills.js:3 Unhandled Promise rejection: Cannot read property 'Ionic' of undefined ; Zone: ; Task: Promise.then ; Value: TypeError: Cannot read property 'Ionic' of undefined

$
0
0

@dogac wrote:

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

Posts: 1

Participants: 1

Read full topic

Local notification not working on ionic v4

$
0
0

@Shola wrote:

Hello, i have been trying for days to figure what could be wrong with the local notification i am trying to implement on my app. I followed the docs step by step but i don’t get any notification. when i checked the console log i found this error:

capacitor-runtime.js:81 ERROR TypeError: this.createCallbackFn is not a function
at Object.exports.hasPermission

this is the version i am using “@ionic-native/android-permissions”: “^5.10.0”,

"@ionic-native/local-notifications": "^5.10.0",

Posts: 1

Participants: 1

Read full topic

Input field language - Keyboard

$
0
0

@venkatvenugopal wrote:

Hi All,

Currently we have a ionic v1 app developed. When we started off we had developed a custom on-screen keyboard. when the app loads the device keyboard is disabled and only the custom keyboard is displayed. This way we were able to restrict the user input only to english and show them only the labels in different languages, because the data to be saved in the client database has to be in english only.

We are planning to convert the app to the latest ionic version (mostly v4) … I wanted to see the better ways to converting the app in related to the custom keyboard.

Now, I am trying to understand if I need to develop the similar custom keyboard in v4 as well or is there any feature available in ionic or
its better to use the device keyboard itself and keep identifying and keep translating the language based on the user keyboard input.

Overall, trying to understand the best practices for it… how other ionic apps are doing it.

Awaiting for a reply.

Thanks,
Venkat.

Posts: 1

Participants: 1

Read full topic

Giving style to random item of HTTP response

$
0
0

@vasanthb wrote:

Hi All, I’m facing an interesting problem, looking for an optimal solution.

I’m getting a JSON response where I need change the text color of a particular field. The field to which I need to change the color is completely random. The number of fields are fixed, so I’m not using any *ngFor on the UI.
Ex:
Response

response = {
firstname: "name_first"
secondname: "nameSecond"
age: "34"
}

HTML part

<ion-list>
 <ion-row >
                <ion-col col-6> First Name</ion-col>
                <ion-col col-6>{{response.firstname}}</ion-col>
</ion-row>
 <ion-row >
                <ion-col col-6> Last Name</ion-col>
                <ion-col col-6>{{response.Lastname}}</ion-col>
</ion-row>
 <ion-row >
                <ion-col col-6> Age</ion-col>
                <ion-col col-6>{{response.age}}</ion-col>
</ion-row>
</ion-list>

I need to change the color of any of this field depending on some condition. Ex: response.age should be of red color. I know I can keep an ID for all of these and use it to change the color. But it would not be a better approach if number of fields increases. Please let me know the best solution for this problem.

Posts: 1

Participants: 1

Read full topic

I am not able to contact rest API after build from AppFlow

$
0
0

@SunTeam wrote:

Hello everyone. I have a problem with my ionic application. In fact, I use AppFlow with a paid package. I can normally generate the apk.
I could even create an automatisation for the generation of the apk after a commit on the main branch.
The problem I have right now is that I can not attack the API from the mobile.
By cons when I build manually locally from my command line, I can successfully attack the API.

I specify that I make the buils on appFlow in release mode.
How would I be able to consume API resources properly?

Ionic Version 3

Posts: 1

Participants: 1

Read full topic

Barcode scanner with capacitor electron on Windows 10

$
0
0

@jwallmueller wrote:

Hi,

I’m currently building an electron app with capacitor which needs to run on Windows 10 tablets.

This app needs to be able to scan QR codes. I’m trying to achieve that with the barcode scanner plugin.
Calling scan() on the barcode scanner always fails with the message “cordova_not_available” also when running the packaged app on a Windows 10 tablet (Surface Pro in that case).

I installed it like so:

npm install @ionic-native/barcode-scanner
npm install phonegap-plugin-barcodescanner
npx cap sync

Here are the dependencies from package.json:

"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",
    "@capacitor/core": "1.1.0",
    "@ionic-native/barcode-scanner": "^5.10.0",
    "@ionic-native/core": "^5.0.0",
    "@ionic/angular": "^4.1.0",
    "@mdi/font": "^3.8.95",
    "@swimlane/ngx-datatable": "^15.0.2",
    "core-js": "^2.5.4",
    "gsap": "^2.1.3",
    "phonegap-plugin-barcodescanner": "^8.1.0",
    "rxjs": "~6.5.1",
    "stream": "0.0.2",
    "three": "^0.106.2",
    "timers": "^0.1.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",
    "@capacitor/cli": "1.1.0",
    "@ionic/angular-toolkit": "~1.5.1",
    "@types/greensock": "^1.15.32",
    "@types/jasmine": "~2.8.8",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "~12.0.0",
    "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"
  },

The relevant parts from app.module.ts:

[...]
import { BarcodeScanner } from '@ionic-native/barcode-scanner/ngx';
[...]
@NgModule({
  declarations: [
    [...]
  ],
  entryComponents: [
    [...]
  ],
  imports: [
    [...]
  ],
  providers: [
    BarcodeScanner,
    [...]
  ],
  bootstrap: [AppComponent]
})
export class AppModule { }

and the implementation:

[...]
import { BarcodeScanner } from '@ionic-native/barcode-scanner/ngx';
[...]

@Component({
  [...]
})
export class InstructionPage implements OnInit {
  [...]

  constructor(private barcodeScanner: BarcodeScanner) { }

  ngOnInit() {
    [...]
  }

 [...]

  scan() {
    this.barcodeScanner.scan()
    .then(data => console.log(data))
    .catch(error => console.error(error));
  }

  [...]
}

I build the app with

ng build -c production --base-href ./
npx cap copy

and package it with

electron-packager . --platform=win32 --overwrite

Here is the content from the package.json in the electron folder:

{
  [...]
  "main": "index.js",
  "scripts": {
    "electron:start": "electron ./"
  },
  "dependencies": {
    "@capacitor/electron": "^1.1.0",
    "electron-is-dev": "^1.1.0"
  },
  "devDependencies": {
    "electron": "^4.0.0"
  },
  "keywords": [
    "capacitor",
    "electron"
  ],
  "author": "",
  "license": "ISC"
}

and the capacitor config:

{
  "appId": "...",
  "appName": "...",
  "bundledWebRuntime": false,
  "npmClient": "npm",
  "webDir": "www"
}

Do you know how to get this plugin to work or how to achieve the scan another way?

Best regards

Posts: 1

Participants: 1

Read full topic


Trying to build Ionic React + AWS app

$
0
0

@srikantap wrote:

Would love to see any post or code which gives the steps to build a Ionic React app which integrated with AWS. Saw one for angular.

Any help is appreciated, thanks!

Posts: 1

Participants: 1

Read full topic

Issue with v-if in vue

$
0
0

@50l3r wrote:

Hi,

I have a problem with css visualization with ionic 4 and vue. I have this html:

<ion-button v-if="!followed" color="primary" class="userFollow" @click="followed = true">
    Seguir
</ion-button>
<ion-button v-else color="medium" fill="outline" class="userUnFollow" @click="followed = false">
    Siguiendo
</ion-button>

When i try to change status clicking in button, my ion-button its set with visibility:hidden because ionic set this part of code in my html:

<style data-styles="">ion-action-sheet,ion-action-sheet-controller,ion-alert,ion-alert-controller,ion-anchor,ion-app,ion-avatar,ion-back-button,ion-backdrop,ion-badge,ion-button,ion-buttons,ion-card,ion-card-content,ion-card-header,ion-card-subtitle,ion-card-title,ion-checkbox,ion-chip,ion-col,ion-content,ion-datetime,ion-fab,ion-fab-button,ion-fab-list,ion-footer,ion-grid,ion-header,ion-icon,ion-img,ion-infinite-scroll,ion-infinite-scroll-content,ion-input,ion-item,ion-item-divider,ion-item-group,ion-item-option,ion-item-options,ion-item-sliding,ion-label,ion-list,ion-list-header,ion-loading,ion-loading-controller,ion-menu,ion-menu-button,ion-menu-controller,ion-menu-toggle,ion-modal,ion-modal-controller,ion-nav,ion-nav-pop,ion-nav-push,ion-nav-set-root,ion-note,ion-picker,ion-picker-column,ion-picker-controller,ion-popover,ion-popover-controller,ion-progress-bar,ion-radio,ion-radio-group,ion-range,ion-refresher,ion-refresher-content,ion-reorder,ion-reorder-group,ion-ripple-effect,ion-route,ion-route-redirect,ion-router,ion-router-outlet,ion-row,ion-searchbar,ion-segment,ion-segment-button,ion-select,ion-select-option,ion-select-popover,ion-skeleton-text,ion-slide,ion-slides,ion-spinner,ion-split-pane,ion-tab,ion-tab-bar,ion-tab-button,ion-tabs,ion-text,ion-textarea,ion-thumbnail,ion-title,ion-toast,ion-toast-controller,ion-toggle,ion-toolbar,ion-virtual-scroll{visibility:hidden}.hydrated{visibility:inherit}</style>

Any ideas?

Posts: 1

Participants: 1

Read full topic

Show uploaded video snapshot as placeholder on mobile app

$
0
0

@sachinputta wrote:

Hi,
We need to upload the .mp4 video into firebase and show the uploaded video as placeholder in the mobile-app.
Currently we are stuck how to show the uploaded video as placeholder.
Thanks
sachin

Posts: 2

Participants: 2

Read full topic

Firebase - Get data from Service inside Service

$
0
0

@Luxaaa wrote:

Hello!

I have 2 Services. One for Subjects, one for Teachers. The Data is stored in the Firebase Firestore.
My Subject Object has a property named teacherId. Then i get the Subject objects from Firebase, I want to get the teacher based on its Id stored in subject from the teacherservice. But i do not know how to do this. I tried the following but i doesn’t work:

import { TeacherService } from './../teacher/teacher.service';
import { Subject } from './../../objects/subject';
import { map } from 'rxjs/operators';
import { Injectable } from '@angular/core';

import {AngularFirestore, AngularFirestoreCollection} from 'angularfire2/firestore'
import { Observable } from 'rxjs';






@Injectable({
  providedIn: 'root'
})
export class SubjectService {
  private subjectsCollection : AngularFirestoreCollection<Subject>;
  private subjects :Observable<Subject[]>;
  public subjectsLocal;
  constructor(db : AngularFirestore, private teacherService : TeacherService  ) {
    this.subjectsCollection = db.collection<Subject>('subjects');
     this.subjects = this.subjectsCollection.snapshotChanges().pipe(
        map(actions => {
          return actions.map(a => {
            const id = a.payload.doc.id;
            let data = a.payload.doc.data();    
            this.teacherService.getTeacher("S7XHgaMhpywmezusLrp2").subscribe(res => {
              data.name = res.name;
            });
            return {id, ...data};
          });
        }));
   }

   getSubjects() {
     return this.subjects;
   }

   getSubject(id) {
    return this.subjectsCollection.doc<Subject>(id).valueChanges();
   }

   updateSubject(subject : Subject, id : string) {
      return this.subjectsCollection.doc(id).update(subject);
   }

   addSubject(subject : Subject) {
     this.subjectsCollection.add(subject);
   }

   removeSubject(id) {
     this.subjectsCollection.doc(id).delete();
   }


}

The Teacherservice looks like this:

import { Teacher } from './../../objects/teacher';
import { map } from 'rxjs/operators';
import { Injectable } from '@angular/core';

import {AngularFirestore, AngularFirestoreCollection} from 'angularfire2/firestore'
import { Observable } from 'rxjs';






@Injectable({
  providedIn: 'root'
})
export class TeacherService {
  private teachersCollection : AngularFirestoreCollection<Teacher>;
  private teachers :Observable<Teacher[]>;
  public teachersLocal;
  constructor(db : AngularFirestore  ) {
    this.teachersCollection = db.collection<Teacher>('teachers');

      this.teachers = this.teachersCollection.snapshotChanges().pipe(
        map(actions => {
          return actions.map(a => {
            const id = a.payload.doc.id;
            const data = a.payload.doc.data();
            
            return {id, ...data};
          });
        }));
   }

   getTeachers() {
     return this.teachers;
   }

   getTeacher(id)  {
    return this.teachersCollection.doc<Teacher>(id).valueChanges();
   }

   updateTeacher(teacher : Teacher, id : string) {
      return this.teachersCollection.doc(id).update(teacher);
   }

   addTeacher(teacher : Teacher) {
     this.teachersCollection.add(teacher);
   }

   removeTeacher(id) {
     this.teachersCollection.doc(id).delete();
   }


}

The value of res in subjectservice contains the correct data but it does not apply to the subject.
Is where a solution?
Thanks!

Posts: 1

Participants: 1

Read full topic

Can Ionic3 receive a phone call automatically?

$
0
0

@ivan5182 wrote:

On ionic3 , we can make a phone call / know which one( phone no. ) Calling you,

But how to automatically answer a phone call?

Thanks a lot

Posts: 1

Participants: 1

Read full topic

New Ionic 4 app - hot deploy not happening despite config

$
0
0

@derceto wrote:

Hi,

Little trouble with getting AppFlow to hot deploy my app…

This is based on a whole new project.

  • The project has been created today (July 24th), with the latest CLI.
  • The Android target has been added (ionic platform cordova add android)
  • An .apk file was successfully created and deployed on the physical android device.
  • It has the right icon, it boots, shows custom splash screen, etc.

So far, so good.

Trying to have my app hot re-deployed, I have done the following:

  • Linked my bitbucket and properly saw my commits appear in the AppFlow web ui
  • Followed the quick install guide (https://ionicframework.com/docs/appflow/quickstart/installation)
  • Re-built my .apk with the updated package (see below, it contains the app id & co).
  • Pushed an update that’s easy to identify (main page contents: hello world -> hello ionic)
  • Created a new web build
  • Assigned that successful build to the Master channel.
  • Re-started the ionic app on the device, re-installed the app, waited with the app in foreground, restarted, etc.

No success so far, it still displays “hello word” instead of getting the latest version “hello ionic”.

The package.json properly shows my app id in the cordova section:

"cordova": {
    "plugins": {
      "cordova-plugin-whitelist": {},
      "cordova-plugin-statusbar": {},
      "cordova-plugin-device": {},
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-ionic-webview": {
        "ANDROID_SUPPORT_ANNOTATIONS_VERSION": "27.+"
      },
      "cordova-plugin-ionic-keyboard": {},
      "cordova-plugin-ionic": {
        "APP_ID": "__THE_ACTUAL_IONIC_APP_ID__",
        "CHANNEL_NAME": "Master",
        "UPDATE_METHOD": "background"
      }
    },
    "platforms": [
      "android"
    ]
  }

However, I observe that the config.xml doesn’t list the “cordova-plugin-ionic” – here is the end of the xml (right after the section):

</platform>
<plugin name="cordova-plugin-whitelist" spec="1.3.3" />
<plugin name="cordova-plugin-statusbar" spec="2.4.2" />
<plugin name="cordova-plugin-device" spec="2.0.2" />
<plugin name="cordova-plugin-splashscreen" spec="5.0.2" />
<plugin name="cordova-plugin-ionic-webview" spec="^4.0.0" />
<plugin name="cordova-plugin-ionic-keyboard" spec="^2.0.5" />
</widget>

So I manually ran the following command, but the terminal states that this plugin is already installed:

cordova plugin add cordova-plugin-ionic --save --variable APP_ID="__THE_ACTUAL_IONIC_APP_ID__" --variable CHANNEL_NAME="Master" --variable UPDATE_METHOD="background"

Additional info:

  • I haven’t subscribed (yet) to the “growth” plan, still using the “starter” one as the 100 hot deploys/month is enough in this early stage.
  • In the meantime, I’m using Adobe Phonegap Build (part of the “Creative Cloud” services). It properly builds my Android .apk and lists the exact plugins found in config.xml (doesn’t list the base “cordova-plugin-ionic”).
  • The Phonegap Build has been configured to use the latest Phonegap CLI (8.0.0 -> iOS 4.5.4 / Android 7.0.0 / web 5.0.0)
  • When opening the “www” folder following my prod build, I perform a full text search on the .js files and none is referring to my Ionic app id… is this normal? Neither the config.xml neither the sources are referring to it.

Thank you very much for your attention so far!

Posts: 1

Participants: 1

Read full topic

Issues with cookies seemingly not being saved directly

$
0
0

@jp4velocity wrote:

I work on an app which communicates with an backend.

When the user logs in, the servers sets some auth cookies. So, when i make calls to the backend i use e.g. this.http.get<T>(uriEndpoint, { withCredentials: true }) which works most of the time.

But when i start the app, log in, then close the app and relaunch the app, the cookies are not sent with the requests, effectively logging out the user.

If i let the app make a few more requests after a successful login, thus keeping it active a bit longer, then close and re-open it this problem does not occur.

It seems like the cookies are not persisted/synced by the webview as they are set.

Am i mistaken here? Shouldn’t the web views store that token faster?

This applies to Android and iOS versions of the app (though i need to be faster with closing the app after a login on iOS to reproduce this).

Posts: 1

Participants: 1

Read full topic


Ionic 4 Modal dynamic height

$
0
0

@vicatcu wrote:

Hi @D4rkMindz did you ever find an answer to this ruthlessly closed GitHub issue you raised? We are running into the same issue on a current project. Any light you might be able to shed on it might be helpful.

Posts: 1

Participants: 1

Read full topic

Is there a standard way to update ionic 4 to the latest stabe?

$
0
0

@distante wrote:

My project is on @ionic/angular 4.1.1 and I would like to update it to the lastest stable release because there are some bugs that are fixed there.

What I usually do is create a new clean project and copy the dependencies to my project but that is tedious and probably dumb.

Is there a way to update a project to the lastest ionic version automatically?

Posts: 1

Participants: 1

Read full topic

Run both Ionic 3 and 4 CLIs on the same system

$
0
0

@obinnae wrote:

I have (and maintain) an Ionic 3 app, and want to build a new app with Ionic 4. Can I run both Ionic 3 & 4 CLI on the same system?

Posts: 1

Participants: 1

Read full topic

Ionic 4 PWA

$
0
0

@KasunGamage wrote:

Hi guys, did anyone know how to prompt add to screen modal in safari browser(ios device) in the progressive web app?

Posts: 1

Participants: 1

Read full topic

Ionic Deploy no longer allowed by Google Play?

$
0
0

@clucani wrote:

I have four apps in production that use ionic deploy but just this week I submitted a new app and google immediately suspended it because of a ‘Malicious behaviour policy’:

“Per policy, an app downloaded from Google Play may not modify, replace or update its own APK binary code using any method other than Google Play’s update mechanism.”

I had to appeal the decision on the grounds that I was not aware of the policy change and that I used a popular framework - Ionic - which provided the remote update functionality as part of it’s enterprise services. They accepted my appeal but are requiring that I remove the remote update function.

Does this mean we can no longer use Ionic Deploy with Android apps?

Posts: 1

Participants: 1

Read full topic

Viewing all 70443 articles
Browse latest View live


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