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

Hi. How to change a selected icon inside ngFor on click. i tried but it ended up in changing all the icons in the loop. Please help

$
0
0

If you use the same Variable in the Loop you change all icons of course. What i normally would do is to add a variable to every List (currentLocation in your case) Item. Then use this variable and change this on click.


[Solved] Detect screen orientation using Capacitor

$
0
0

Your wit, or your code
I don’t know which is more satisfying

Which is the difference between imports and providers in app.module?

$
0
0

Hi,
I’ve seen that in many tutorials that there is a different use of the imports and of the providers section of the file app.module.ts.

@NgModule({
  declarations: [AppComponent],
  entryComponents: [],
  imports: [
    BrowserModule,
    IonicStorageModule.forRoot(),
	....
	],
  providers: [
    StatusBar,
    SplashScreen,
	...
  ],
  bootstrap: [AppComponent]
})
export class AppModule {}

What should go in the import section and what should go in the providers section?
When I create a new service provider should I put in the providers section?

Because when I create a service provider I’m not putting them in the providers section but I’m importing them in each page:

    constructor(
         ...
        private translate: TranslateService,
        private settingsManager: SettingsmanagerService,
       private wsManager: WsmanagerService,**
    ) {

Excuse me for these questions, but I didn’t find a good theoric explanation of these concepts in the Ionic documentation.

Thank you very much

Claudio

PWA filesystem

$
0
0

Thanks for sharing this. Looks like the API is still in progress but it seems to be able to manage files in the file system. Will keep a lookout for this.

Google Login error 10

Error 10 in ionic 4 native google plus login

Core.js:6014 ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'then' of undefined TypeError: Cannot read property 'then' of undefined

$
0
0

i getting core.js:6014 ERROR Error: Uncaught (in promise): TypeError: Cannot read property ‘then’ of undefined
TypeError: Cannot read property ‘then’ of undefined error while using SQlite in latest ionic version.

please solve my question

thanks in advance

Trigger manually ngFor or making it update DOM correctly

$
0
0

Thank you for your response.
I’ve resolved creating a new array with:

this.foodAllergies = […this.foodAllergies, res.data]

Instead of updating the existing one with this.foodAllergies.push(res.data)


Which is the difference between imports and providers in app.module?

$
0
0

As you said a Provider needs to be defined in the provider Section :smiley: Otherwise you will get an Error when you try to create it in the constructor. In the Imports you can import other Modules.

Tipp: Since a Angular Version (i don’t know exactly which one), you can provide your Services automatically with:

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

Core.js:6014 ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'then' of undefined TypeError: Cannot read property 'then' of undefined

$
0
0

Please post the Code Piece, where the Error appears.

Global project counter with behavior subject

$
0
0

Mhh i don’t know if i get your Question correctly. You want to observe a new Value to the countProject Subject?

Connection Refused

$
0
0

I am building a mobile app for Android using Ionic + Angular and I implement an OAuth2 workflow.

When the authentication endpoint redirects back to my app, the navigation is blocked showing the following message:

Application Error
net::ERR_CONNECTION_REFUSED(http://localhost/home?code=)

When serving my app with livereload it works fine, probably because a port is added to the url.

Ionic 4 - Build for browser

$
0
0

Hi where to add and use .htaccess file

Core.js:6014 ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'then' of undefined TypeError: Cannot read property 'then' of undefined

$
0
0

Database.service.ts

import { Injectable } from ‘@angular/core’;
import { Platform } from ‘@ionic/angular’;
import { SQLitePorter } from ‘@ionic-native/sqlite-porter/ngx’;
import { HttpClient } from ‘@angular/common/http’;
import { SQLite, SQLiteObject } from ‘@ionic-native/sqlite/ngx’;
import { BehaviorSubject, Observable } from ‘rxjs’;

export interface DriversList {
id: number,
name: string,
skills: any,
img: string
}

@Injectable({
providedIn: ‘root’
})
export class DatabaseService {
private database: SQLiteObject;
private dbReady: BehaviorSubject = new BehaviorSubject(false);

driver = new BehaviorSubject();
// products = new BehaviorSubject();

constructor(private plt: Platform, private sqlitePorter: SQLitePorter, private sqlite: SQLite, private http: HttpClient) {
this.plt.ready().then(() => {
this.sqlite.create({
name: ‘driver.db’,
location: ‘default’
})
.then((db: SQLiteObject) => {
** console.log(‘success creationDB’);**

** this.database = db;**
** this.driversDatabase();**
});
});
}

driversDatabase() {
this.http.get(’…/assets/driversListData.sql’, { responseType: ‘text’ })
.subscribe(sql => {
this.sqlitePorter.importSqlToDb(this.database, sql)
.then(_ => {
console.log(‘success drversdatabase’);
this.loadDevelopers();
// this.loadProducts();
this.dbReady.next(true);
})
.catch(e => console.error(e));
});
}

getDatabaseState() {
return this.dbReady.asObservable();
}

getDevs(): Observable<DriversList> {
return this.driver.asObservable();
}

// getProducts(): Observable<any> {
// return this.products.asObservable();
// }

loadDevelopers() {
console.log(‘success load driver’);

return this.database.executeSql('SELECT * FROM driver', []).then(data => {
  const drivers: DriversList[] = [];
  console.log('data driver', data);
  

  if (data.rows.length > 0) {
    for (var i = 0; i < data.rows.length; i++) {
      let skills = [];
      if (data.rows.item(i).skills != '') {
        skills = JSON.parse(data.rows.item(i).skills);
      }

      drivers.push({
        id: data.rows.item(i).id,
        name: data.rows.item(i).name,
        skills: skills,
        img: data.rows.item(i).img
      });
    }
  }
  this.driver.next(drivers);
});

}

}

that highlilghted code is getting error

Ionic 4: failed facebook login with android when the native facebook app is installed

$
0
0

In which file are these changes to be made? Do you get the exact solution for this?


Ionic 4: failed facebook login with android when the native facebook app is installed

$
0
0

not working for me…plz help…

Facebook Login Error

$
0
0

do you get the solution for this?

Build on iOS with capacitor (xCode) and plugin background-geolocation is not working. Error: redefinition of enumerator 'NotReachable'

Build on iOS with capacitor (xCode) and plugin background-geolocation is not working. Error: redefinition of enumerator 'NotReachable'

Ionic 4 facebook login

$
0
0

How to set facebook login for web only in ionic 4 app?

Viewing all 230523 articles
Browse latest View live


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