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.
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
[Solved] Detect screen orientation using Capacitor
Your wit, or your code
I don’t know which is more satisfying
Which is the difference between imports and providers in app.module?
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
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
No error 10, please take help from below link
Error 10 in ionic 4 native google plus login
Please check below link.
Core.js:6014 ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'then' of undefined TypeError: Cannot read property 'then' of undefined
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
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?
As you said a Provider needs to be defined in the provider Section 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
Please post the Code Piece, where the Error appears.
Global project counter with behavior subject
Mhh i don’t know if i get your Question correctly. You want to observe a new Value to the countProject
Subject?
Connection Refused
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
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
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
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
not working for me…plz help…
Facebook Login Error
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'
Hi,
I know this bug belongs to the cordova-plugin-background-geolocation, but I was wondering if someone here can help me.
I created an issue on github of the project: https://github.com/mauron85/cordova-plugin-background-geolocation/issues/692
In general the build on iOS with capacitor is not working.
Build on iOS with capacitor (xCode) and plugin background-geolocation is not working. Error: redefinition of enumerator 'NotReachable'
i say it often, but i know people don’t want to hear: Sadly there is currently no free, working and maintained Plugin for Background Geolocation. But there is a paid one, which our team decided to buy and it works perfect. Check it out here: https://github.com/transistorsoft/cordova-background-geolocation-lt
As far as i know it works for capacitor too
Ionic 4 facebook login
How to set facebook login for web only in ionic 4 app?