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

Problem trying to get values from my API ionic 4

$
0
0

@retorres9 wrote:

I’m trying to get the values from my API but I can’t show the in ion-list.
In the image you can see that the data is loaded but I can’t show them in ion-list


I try tho show the in this way
<ion-list>
    <ion-item *ngFor="let item of (results | async)">

      <ion-label text-wrap>{{item.nombreProducto}}</ion-label>
      <ion-button color="light"><img src="../../assets/icon/binoculars.png" alt="" (click)="presentarModal()" item-end></ion-button>
      <ion-button color="light"><img src="../../assets/icon/cart.png" alt="" (click)="addCart()" item-end></ion-button>
    </ion-item>
  </ion-list>

I’ve created a service that have a method called getAll

getAll(): Observable<any>{
return this.http.get(`${this.url}`).pipe(
  map(results=>{
    console.log('Data', results);
    return results['Data'];
  })
);

And in my home.page.ts the getAll method contain this

getAll(){
  this.results = this.productService.getAll();
}

What i’m doing wrong?

Posts: 1

Participants: 1

Read full topic


Deeplinking for hybrid apps

$
0
0

@JerryBels wrote:

Hello,

Deeplinking in an Ionic hybrid app feels like something that should be really straightforward - but I really struggle to find an ideal solution.

What solution would you recommend, and if it’s one of these three, how to overcome their flaws ?

Posts: 1

Participants: 1

Read full topic

Application Close button for ionic 4.10.3 side menu android and ios app

$
0
0

@Ronbd53 wrote:

I am realy Confused in ionic 4.10.3 . after crating a android application . when i am going to test this on my android device . i realize , my application did not exit when i tap my back button . don’t know why. but its not good for production . if ionic developer team delete this back button future , they must assain a function that help to exit/close a application after clicking the button . i tryed navigator[‘app’].exitApp() . but this function only work blank project . but it does not work for side menu project . Any one here , who can tell me . how i can fix it ? i am really confused .

Posts: 1

Participants: 1

Read full topic

Sqlite executeSql throws window.angular.element is not a function

$
0
0

@carol_braileanu wrote:

Hello,

I have a project in Ionic 4 in which I am trying to use an SQLite database:

this.platform.ready().then(az => {
      this.sqlite.create({
        name: 'ionicdb.db',
        location: 'default'
      }).then((db: SQLiteObject) => {

        db.executeSql('CREATE TABLE IF NOT EXISTS table1 (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL UNIQUE, title TEXT)').then(a=> console.log('success'));
    });
});

I tried to run the code above on a device. The databased is created / opened successfully but the executeSql call throws the following error:

vendor.js:51623 ERROR Error: Uncaught (in promise): TypeError: window.angular.element is not a function
TypeError: window.angular.element is not a function
    at getPromise (vendor.js:78995)
    at vendor.js:79385
    at cordovaInstance (vendor.js:79471)
    at SQLiteObject.push../node_modules/@ionic-native/sqlite/ngx/index.js.SQLiteObject.executeSql (vendor.js:79826)
    at main.js:1308
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (polyfills.js:2749)
    at Object.onInvoke (vendor.js:53198)
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invoke (polyfills.js:2748)
    at Zone.push../node_modules/zone.js/dist/zone.js.Zone.run (polyfills.js:2508)
    at polyfills.js:3247
    at resolvePromise (polyfills.js:3189)
    at polyfills.js:3254
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (polyfills.js:2781)
    at Object.onInvokeTask (vendor.js:53189)
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (polyfills.js:2780)
    at Zone.push../node_modules/zone.js/dist/zone.js.Zone.runTask (polyfills.js:2553)
    at drainMicroTaskQueue (polyfills.js:2959)

Any idea why might this happen?
Thank you!

Posts: 1

Participants: 1

Read full topic

Ionic integration with Braintree

$
0
0

@gentlemanoi wrote:

Cannot add cordova plugin:

ionic cordova plugin add https://github.com/taracque/cordova-plugin-braintree

with this error:

(node:19084) UnhandledPromiseRejectionWarning: CordovaError: Failed to fetch plugin https://github.com/taracque/cordova-plugin-braintree via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
Error: cmd: Command failed with exit code 1 Error output:
npm ERR! code 1
npm ERR! Command failed: git submodule update -q --init --recursive
npm ERR! C:\Program Files\Git\mingw64/libexec/git-core\git-submodule: line 7: basename: command not found
npm ERR! C:\Program Files\Git\mingw64/libexec/git-core\git-submodule: line 7: sed: command not found
npm ERR! C:\Program Files\Git\mingw64/libexec/git-core\git-submodule: line 19: .: git-sh-setup: file not found
npm ERR!

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Dell\AppData\Roaming\npm-cache\_logs\2019-03-03T13_48_13_743Z-debug.log
    at C:\Users\Dell\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\plugman\fetch.js:173:37
    at _rejected (C:\Users\Dell\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:864:24)
    at C:\Users\Dell\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:890:30
    at Promise.when (C:\Users\Dell\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:1142:31)
    at Promise.promise.promiseDispatch (C:\Users\Dell\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:808:41)
    at C:\Users\Dell\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:624:44
    at runSingle (C:\Users\Dell\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:137:13)
    at flush (C:\Users\Dell\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:125:13)
    at process._tickCallback (internal/process/next_tick.js:61:11)
(node:19084) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)

Thank you.

Posts: 1

Participants: 1

Read full topic

StaticInjectorError

$
0
0

@faridb wrote:

Hello,

I have the following error :

ERROR Error: Uncaught (in promise): Error: StaticInjectorError(AppModule)[Tab1Page -> EventProvider]: **
** StaticInjectorError(Platform: core)[Tab1Page -> EventProvider]: **
** NullInjectorError: No provider for EventProvider!

Error: StaticInjectorError(AppModule)[Tab1Page -> EventProvider]: **
** StaticInjectorError(Platform: core)[Tab1Page -> EventProvider]: **
** NullInjectorError: No provider for EventProvider!

This is my code in tab1

this.event.loadEventsByUser(2)
.then((res:Event)=>
{
this.EventsLoad = res;
})
.catch(err => console.log(err));

And this is my code in EventProvider.ts :

loadEventsByUser(userid) {
return new Promise((resolve, reject) => {
console.log("this.userid = " + this.UserId);
this.http.api().get(‘Events/GetEventsByUserId’, { search: { userid: userid } })
.subscribe((data: any) => {
console.log("Data = " + data)
resolve(data);
})
});
}

And this is my code in httpclient.ts

get(url: string, options?: RequestOptionsArgs): Observable<Response> {

return from(this.setHeaders(options)).pipe(mergeMap(options => super.post(url, options)));

}

Can anyone help me ? Where am’I Wrong ?

Tks for your help

Posts: 1

Participants: 1

Read full topic

Override external URL action

$
0
0

@ReaXioN wrote:

So here’s my situation, I hope you can help me out

  • on an App, i have an external URL that i get from my WordPress Posts. this is how the element appears
<a target="_blank" rel="noopener noreferrer" href="https://whateverdomain.co.za/"><strong><u>Stream song now</u></strong></a>
  • when I click on it; instead of opening the external or InApp browser. I Want to execute my own function

any suggestions on how to do this or code Snippets would be highly Appreciated
Thank You

Posts: 1

Participants: 1

Read full topic

Ionic and Firebase (Getting the List of Names from Firebase)

$
0
0

@AmberS wrote:

Hi, I am trying to get the list of names from my Firebase Realtime Database. Below you will see the steps I have taken to do this. However, my problem is that nothing is showing when I am on the page! If anyone have any better suggestions, please let me know! To note: I am only reading the data from Firebase, not writing, deleting or creating.

Firebase Database Structure:

0
  Email: "someoneEmail@gmail.com"
  Location: "Building 0"
  Name: "Someone Name"
  Phone Number: "333-3333"

Copy my credentials to a a new file in src/app/credentials.ts

export var firebaseConfig = {
  apiKey: "Your credentials here",
  authDomain: "Your credentials here",
  databaseURL: "Your credentials here",
  projectId: "Your credentials here",
  storageBucket: "Your credentials here",
  messagingSenderId: "Your credentials here",
};

Initialized Firebase in app.module.ts and inside @NgModule() look for your imports array

import { firebaseConfig } from './credentials';

import { AngularFireModule } from '@angular/fire';

import { AngularFirestoreModule } from '@angular/fire/firestore';

import { AngularFireStorageModule } from '@angular/fire/storage';

// This is inside @NgModule()
import { AngularFireDatabaseModule } from '@angular/fire/database';
imports: [BrowserModule, IonicModule.forRoot(), AppRoutingModule,
    AngularFireModule.initializeApp(firebaseConfig), AngularFirestoreModule, AngularFireDatabaseModule],

Added this line inside the initializeApp function for running the Firebase configuration in app.component.ts.
firebase.initializeApp(firebaseConfig);

Open and edit src/app/directory/directory-list.page.ts then add this import.

import * as firebase from 'firebase';
import { LoadingController } from '@ionic/angular';

Declare variables before the constructor to hold list and referencing Firebase database.

infos = [];
ref = firebase.database().ref('infos/');

Add this Firebase function to listening any value changes from Firebase Database.

constructor(private router:Router , private location:Location,public loadingController: LoadingController) {
    this.ref.on('value', resp => {
      this.infos = [];
      this.infos = snapshotToArray(resp);
    });
   }

Add this constant function below the Class block for converting Firebase response to an array.

export const snapshotToArray = snapshot => {
    let returnArr = [];

    snapshot.forEach(childSnapshot => {
        let item = childSnapshot.val();
        item.key = childSnapshot.key;
        returnArr.push(item);
    });

    return returnArr;
};

Trying to show the list in directory-list.page.html

<ion-content>
<ion-card *ngFor="let info of infos">
      <ion-card-header>
        {{ info.Name }}
      </ion-card-header>
  </ion-card>
</ion-content>

Again, my problem is that nothing is actually showing, the page is just blank except for the styling of the background. Therefore, I am not getting the list of names from Firebase Realtime Database. I really need help as soon as possible

Posts: 1

Participants: 1

Read full topic


Ionic -v3 frontend and php Backend

$
0
0

@akmca1628 wrote:

I have created frontend in ionic 3. Currently I am using php as a backend on localhost.
what steps i have to follow to host php backend and use it as a backend for ionic 3 frontend.
Below is my code where i am accessing php files for backend on localhost.
So what i have to change if i host php files .

import { Http,Headers,RequestOptions } from '@angular/http';
import {Injectable} from '@angular/core';
import 'rxjs/add/operator/map';


@Injectable()
export class PostProvider {
  server:string ="http://localhost/myproject/";

  constructor(public http: Http) {}
 

  postData(body,file){
	 
    let type="application/json; charset-UTF-8";
    let headers=new Headers({'Content-Type':type});
    let options=new RequestOptions({headers:headers});
    return this.http.post(this.server+file,JSON.stringify(body),options)
    .map(res=>res.json());

  }

}

Posts: 1

Participants: 1

Read full topic

Ionic Tabs with ViewEncapsulation.None V4

$
0
0

@anjildhamala1 wrote:

How do I work with global view encapsulation ‘none’ with Ionic Tabs? My tabs rendered fine before I set the global View Encapsulation to none. After doing so, I can see that the component is being mounted (via. constructor logs). However, I don’t seem the html being rendered.

Posts: 1

Participants: 1

Read full topic

Open link api in inappbrowser

$
0
0

@eversonsarcevic wrote:

I’m trying to open an api link using inappbrowser. It is possible?

<div *ngIf="post.featured_image">
   <ion-img padding-top class="featured-image" [src]="post.featured_image"></ion-img>
    <div class="center-message">
     <div class="banner2">
      <h3 [innerHTML]="post.title.rendered"></h3>
      <p [innerHTML]="post.content.rendered"></p>
     </div>
    </div>
  </div>

{

This is the api I’m using.

Posts: 1

Participants: 1

Read full topic

Unable to set background image on page

$
0
0

@DMoney wrote:

I’ve been unable to set a background image in Ionic 4. I’ve tried

     ion-content {
       --background: #fff url("../../../assets/img/login-image.jpg") no-repeat center center / cover;
     }

and
ion-content {
background-image: url("…/…/…/assets/img/login-image.jpg");
-webkit-background-image: url("…/…/…/assets/img/login-image.jpg");
background-repeat: no-repeat;
background-size: cover;
}

I’m certain the relative paths are correct because if I change them I get a compile error.

page-details {
     ion-content {
       --background: #fff url("../../../assets/img/login-image.jpg") no-repeat center center / cover;
      // background-image: url("../../../assets/img/login-image.jpg");
      // -webkit-background-image: url("../../../assets/img/login-image.jpg");
      // background-repeat: no-repeat;
      // background-size: cover;
     }
form {
  margin-bottom: 32px;
  button {
    margin-top: 20px !important;
  }
}

p {
  font-size: 0.8em;
  color: #d2d2d2;
}

ion-label {
  margin-left: 5px;
}

ion-input {
  padding: 5px;
}

.invalid {
  border-bottom: 1px solid #ff6153;
}

.error-message {
  min-height: 2.2rem;
  ion-label {
    margin: 2px 0;
  }
}
}
`type or paste code here`

Posts: 1

Participants: 1

Read full topic

Ionic cordova platform add problem with ionic3

$
0
0

@mohamedhassan2524 wrote:

Any help with ionic cordova platform add android: when i run this commend i found this error!!

ionic cordova platform add android

[ERROR] Exception: Using cordova-fetch for cordova-android@~7.1.1

    Adding android project...
    Creating Cordova project for the Android platform:
            Path: platforms\android
            Package: io.ionic.starter
            Name: ionicFirebase
            Activity: MainActivity
            Android target: android-27
    Android project created with cordova-android@7.1.4
    Android Studio project detected
    Android Studio project detected
    Source path does not exist: resources/android/icon/drawable-hdpi-icon.png

and when i run platform ls i am found android@7.1.4 in install platform but on ionic project folder no create any directory to platforms install also when i remove resources/android directory manually and run ionic cordova resources directory don’t create again??

i am try run this commend after and before remove platform same the following error:

ionic cordova resource

√ Collecting resource configuration and source images - done!

[ERROR] No platforms detected. Please run: ionic cordova platform add

and same error when rm android and run again ionic cordova resources and when run ionic cordova resources and add platform again same error can’t find path!! I can’t find any solution to my problem and try cordova v7.0.1 and latest and v6.3.1 and CLI 3.19.0 With cordova7.0.0 every version i found the same error and this my ionic info !!!

ionic info

cli packages:

@ionic/cli-utils  : 1.12.0
ionic (Ionic CLI) : 3.12.0

global packages:

cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)

local packages:

@ionic/app-scripts : 3.1.0
Cordova Platforms  : android 7.1.4
Ionic Framework    : ionic-angular 3.9.2

System:

Android SDK Tools : 25.2.5
Node              : v6.16.0
npm               : 4.6.1
OS                : Windows 10

Misc:

backend : pro

Posts: 1

Participants: 1

Read full topic

Ionic 4 and root page

$
0
0

@aardra wrote:

Hi All

I am using ionic 4.

I would like to know how can i select the first page that loads up after the splash screen.

I would like to use any api to query some data at load time, once the data reply is returned then switch off the splash screen and then load the correct first page.

I have been searching but not found anything that can help me.

Thank You

Posts: 1

Participants: 1

Read full topic

Setting Root page in Ionic 4

$
0
0

@DMoney wrote:

My app is routing to the page based on the condition but the login page appears briefly before routing users to the profile page. How can I prevent that?

  initializeApp() {
    firebase.initializeApp(firebaseConfig);

    this.platform.ready().then(() => {
        const unsubscribe = firebase.auth().onAuthStateChanged( user => {
          if (!user) {
            this.router.navigateByUrl('login');
            unsubscribe();
            console.log('if !user', user);
          } else {
            this.router.navigateByUrl('profile');
            unsubscribe();
            console.log('if user', user);
          }
        });
      this.statusBar.styleDefault();
      this.splashScreen.hide();
    });
  }

Posts: 1

Participants: 1

Read full topic


Twilio comms integration with IONIC 3

$
0
0

@Gazuntite wrote:

Has anyone successfully integrated twilio comms (voice and video) such that calls can be successful received through the iOS and Android OS locked screen. Particularly when the Ionic app is killed?

Posts: 1

Participants: 1

Read full topic

How to have a custom history and display the back buttons on a deep link?

$
0
0

@badpenguin wrote:

Is there a way to construct the history when accessing a deep link?
For instance when reloading the url /trips/africa/casablanca
the ion-back-button should display and go back to /trips/africa
and then to /trips and finally to /home

Posts: 1

Participants: 1

Read full topic

Ionic 4 PWA Toolkit and iOS push notifications

$
0
0

@kdawg1406 wrote:

I’ve read the PWA’s don’t support push notifications on iOS.

Then I read the PWA Toolkit page here and push notifications are listed.

Can someone confirm the PWA Toolkit will allow push notifications on iOS?

Thank you very much,

Karl

Posts: 1

Participants: 1

Read full topic

Easy ion-radio question

$
0
0

@wekas wrote:

I must be missing something super obvious here.
For some reason I can “check” the ion-radio by clicking on it but I can’t un-check it again.
Any ideas?
Ionic 4.
Just hard-coded the checked to false for now.

<ion-item>
    <ion-label position="floating">{{currentCheck.name}}</ion-label>
    <ion-radio slot="start" value="pass" checked="false"></ion-radio>
</ion-item>

Posts: 1

Participants: 1

Read full topic

Page not loaded fully on ios devices

$
0
0

@rekony wrote:

Hey All

I’ve recently encounter the following issue where the page (let’s call this Page A) is loaded but the bounded images and text was not displaying to the screen.

The page was navigated from “Page Source” via a button click, triggers the pin dialog and navigate it to the Page A e.g

buttonClickFunction() {
this.platform.ready().then(() => {
this.PinDialog.prompt(‘enter xxx’, ‘enter xxx’, [‘OK’, ‘Cancel’]).then(
(result: any) => {
if (result.buttonIndex == 1)
{
this.route.navigateByUrl(’/Page A’);
}
}
);
});
}

Page A - Code snippet
<img [src]=“status == ‘success’ ? ‘assets/img/success.png’ : ‘assets/img/error.png’” height=“150px” width=“150px”>
<span class=“success-text success-text1” [innerHTML]=“messageString1”></span><br>

I’ve assigned default value to the success and messageString1 param

If i removed the PinDialog step and perform the navigate to Page A from the button click. It works, all the images and text loaded successfully.

This issue only happens in ios device. Browser and Android device is fine

Posts: 1

Participants: 1

Read full topic

Viewing all 70440 articles
Browse latest View live


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