Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all 49268 articles
Browse latest View live

Alert with Fisher – Yates shuffle / Market App

$
0
0

I’ve a list of market items, every time the customer confirms the alert, the list must be mixed up. I’m using Fisher - Yates shuffle, but when I look at the “serve --lab” result, the shuffling doesn’t happen.

public Vegetables = [‘Carrot.’, ‘Broccoli.’, ‘Asparagus.’, ‘Cauliflower.’, ‘Corn.’, ‘Cucumber.’, ‘Eggplant.’, ‘Lettuce.’, ‘Radish.’, ‘Okra.’]

async Vegatableslist() {

const alert = await this.alert.create({

  cssClass: 'my-custom-class',

  message: 'Do you want to reorder items?',

  buttons: [

    {

        text: 'No.',

        handler: () => {

        }

    },

    {

       text: 'Yes, please.',

       handler: () => {

function shuffle(array) {

var Vegetables = array.length, t, i;

while (Vegetables) {

i = Math.floor(Math.random() * Vegetables- -);

t = array[Vegetables];

array[Vegetables] = array[i];

array[i] = t;

}

return array;

}

       }

   }

],

});

await alert.present();

}

I used this code: Fisher–Yates Shuffle. My Ts does not report an error, but the action does not happen in “serve --lab” and this message appears on function shuffle: " ‘shuffle’ is declared but its value is never read."

Can someone help me? Alert and scrambling are company criteria.

1 post - 1 participant

Read full topic


Format from ionic-datetime keeps changing when selecting a new date

$
0
0

Hi all!

I’ve been struggling with the ionic-datetime component today.

So I have this piece of code in my .html:

 <ion-item class="container-date" lines="none">
    <ion-datetime displayFormat="DD/MM/YYYY" pickerFormat="DD/MM/YYYY" [(ngModel)]="date" placeholder="{{ date }}"></ion-datetime>
  </ion-item>

And the following in my .ts file:

date = moment(new Date()).format("DD/MM/YYYY");

I’ve also tried this; same result though:

date = new Date().toISOString();

So the format before I select a new date is as follows:
29/03/2021
When I select a new date (let’s say 30/03/2021) it changes to “2021-03-30” and when I try changing it again it changes to “2021-03-31T00:00:00+02:00”.

I have no clue what to do anymore. Thanks in advance!

FYI, I want to sort date from my local json file using the datetime component. And I need a specific format for that to work.

1 post - 1 participant

Read full topic

Multicamera management

$
0
0

Hei there!

I got a problem. Using the camera plugin I can get the CameraDirection.
The problem is that for some phones (e.g. Samsung A51) having FRONT or REAR is not enough to use the desired camera. I explain better. I need to start with the standard REAR camera, but the plugin redirect me to the Zoom for example. This is a random behaviour ( I was considering a flip, but it is not always behaving the same way before).

How can I select the right camera since the beginning and be sure it will be the standard on every phone ?

Many thanks to everyone for any suggestion.

1 post - 1 participant

Read full topic

How to use plyr with ionic 5

$
0
0

Hello
I have use ionic 5 with anglur

I find HTML5 player

I need way to add it to my app

1 post - 1 participant

Read full topic

HttpClientModule multipart/form-data auth

$
0
0

Hi, I’m working on it for days and don’t know what to do anymore, so my problem:

      const headers   : HttpHeaders = new HttpHeaders()
        .set('Authorization', `Basic ${btoa(this.PUBLISHABLE_KEY)}`)
        .set('Content-Type',  'multipart/form-data;boundary=---011000010111000001101001');
       //.set('Content-Type',  '');
      const fileBlob  : any         = new Blob([fileImage], { type: `image/${mimeType}` });
      const fd        : FormData    = new FormData();
      fd.append('file',     fileBlob, fileName);
      fd.append('category', category);
      return this.http.post(url, fd, { headers });
      //return this.http.post(url, fd);
    

I used postman and it worked ok, but in my code nothing done.
I saw answers to get rid of Content-Type, but even if I put this = ‘’ I got CORS errors from server.
I don’t have access to the api it’s from a credit card.
I saw answers to get rid of headers, but I need to pass the authorization.

{“error”:{“status”:“API Configuration Error”,“status_code”:510,“type”:“processing_error”,“category”:“gateway_error”,“message”:“Internal server error”}}

Thanks in advanced.

1 post - 1 participant

Read full topic

Components style dynamic

$
0
0

Hi, i have implemented a image lazy loading component in my ionic app. And i am passing url and background size parameters to my component. I want to add background style for my root like I mentioned in this picture.

1 post - 1 participant

Read full topic

Open PDF with specified page no

Keep Up-To-Date Strategy

$
0
0

I would like to adopt a strategy to keep my ionic projects up to date by dedicating time to them at a gentle cadence to avoid finding myself with too much work to do and maybe leaving some projects with different and old versions of ionic (and angular). It can be expensive but having all the projects updated to the same version (even if maybe not the latest) I think it’s the best strategy. So monthly I create the branch “update to vers x.y.z” update and try to solve any problems quickly. Do you have any suggestions or considerations on this?

1 post - 1 participant

Read full topic


Slow back to Home only on Android

$
0
0

Hi everyone, I’m new to ionic, and I’m developing my first application with it, it’s almost finished, but I have a problem that only occurs on Android devices, while on IOS and WEB I have no problem.

In practice, when I click on the button to return to the Home, be it an ion-back-button or a simple button with router-link, the application freezes for 1 second and then returns to the Home, even the animation of the button starts later 1 second.

When it returns to the Home no API calls or anything is made so it has no reason to slow down.

This happens from any page I come from.

While between the various pages I can switch very quickly even on Android devices, so I think the problem is in the Home, but I don’t understand why only on Android devices.

I noticed that on Android Studio when I go back to it comes out this error that I have never seen:
I / HwViewRootImpl: removeInvalidNode all the node in jank list is out of time

I leave you some information about the project:

HTML HOME :
https://pastebin.com/SxqPWwE1

CSS HOME:

https://pastebin.com/HHb2LRYp

HOME MODULE:
https://pastebin.com/xfkEgMNM

HOME TS:
https://pastebin.com/utARzH5T

I hope this information is enough, I cannot share my project on git because it is private and I keep personal information, but if an Admin can help me, I can send him the repository in private

I apologize for my bad English

Update: I commented the supertabs on the home-page.html file and now also on Android it goes fast, so I think the problem comes from one of the pages I load in the home, also the error on Android Studio is gone, so surely that slowdown comes from this error:
I / HwViewRootImpl: removeInvalidNode all the node in jank list is out of time

Update: I discovered that I have this error on Android Studio only if the deals-list.page page is visible and in fact by leaving only this page visible I have this problem (I mean both the error present on Android Studio and both the app that slows down if I go back to the Home), while if I leave the other 3 pages visible in the Home I don’t have this problem.

So I think it’s useful to leave you the code of that page:

deals-list.page.ts

deals-list.page.html

deals-list.page.scss

I think the problem is in my ion-list, or on list to show, please help me!

1 post - 1 participant

Read full topic

SelectedText/Placeholder Alternatives?

$
0
0

Hi there, I currently have a settings area in which I get the values from the user’s settings from the database. I want to display it to the user but I find that a placeholder makes the text muted and SelectedText does not change when the user selects a different temperature from the dropdown.

<IonSelect interface="popover" value={values.maxTemp} selectedText={`${userSettings?.maxTemp} ℃`} name="max-temp" placeholder="Maximum Temperature" onIonChange={setMaxTemp}>
  {temps.map((temp) => (
      <IonSelectOption value={temp.temp}>{temp.temp} &#8451;</IonSelectOption>
  ))};
</IonSelect>

Do you guys know of any other suggestions than selectedText/Placeholder that shows the current values from the database but when the users go to change it changes the value on the dropdown too?

1 post - 1 participant

Read full topic

Ionic react installation error

$
0
0

Hi all,

I am very very new to Ionic, I follow the tutorial and just want to install the ionic react,

but after run: ionic start and input the project name, then I got this error: :worried:

? Starter template: blank
:heavy_check_mark: Preparing directory ./ionic_react_bmi in 970.06μp
:heavy_check_mark: Downloading and extracting blank starter in 193.87ms

ionic integrations enable capacitor --quiet – ionic_react_bmi
io.ionic.starter
npm i --save -E @capacitor/core
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
**npm ERR! **
npm ERR! Found: @babel/core@7.12.3
npm ERR! node_modules/@babel/core
npm ERR! @babel/core@“7.12.3” from react-scripts@4.0.2
npm ERR! node_modules/react-scripts
npm ERR! react-scripts@“4.0.2” from the root project
npm ERR! @babel/core@"^7.12.3" from @svgr/webpack@5.5.0
npm ERR! node_modules/@svgr/webpack
npm ERR! @svgr/webpack@“5.5.0” from react-scripts@4.0.2
npm ERR! node_modules/react-scripts
npm ERR! react-scripts@“4.0.2” from the root project
npm ERR! 9 more (babel-jest, babel-loader, …)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @babel/core@"^7.13.0" from @babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@7.13.12
npm ERR! node_modules/@babel/preset-env/node_modules/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining
npm ERR! @babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@"^7.13.12" from @babel/preset-env@7.13.12
npm ERR! node_modules/@babel/preset-env
npm ERR! @babel/preset-env@"^7.12.1" from @svgr/webpack@5.5.0
npm ERR! node_modules/@svgr/webpack
npm ERR! @svgr/webpack@“5.5.0” from react-scripts@4.0.2
npm ERR! node_modules/react-scripts
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /Users/yinggu/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/yinggu/.npm/_logs/2021-03-31T00_37_27_108Z-debug.log
[ERROR] An error occurred while running subprocess npm.

    npm i --save -E @capacitor/core exited with exit code 1.
    
    Re-running this command with the --verbose flag may provide more
    information.

It told me I should use --force fix this problem, but I have no idea, how to do this… Can you give me some suggests? :sweat_smile:

2 posts - 1 participant

Read full topic

Slide pagination aligned with button

$
0
0

I need to insert a slide for a tour page and align the pagination with the next and return buttons. But I’m taking a beating to do this.

I tried aligned using display inline amd the result was not ok. Now I have this result.

image

My code.

<ion-slides #slides pager="true">
    <ion-slide>
      <div class="slide">
        <img class="img-fluid" src="assets/img/tour/tour1.png" />
      </div>
    </ion-slide>

    <ion-slide>
      <div class="slide">
        <img class="img-fluid" src="assets/img/tour/tour2.png" />
      </div>
    </ion-slide> 
  </ion-slides>

  <ion-button (click)="slides.slidePrev()">
    <ion-icon name="chevron-back-outline"></ion-icon>
  </ion-button>

  <ion-button (click)="slides.slideNext()" class="float-right">
    <ion-icon name="chevron-forward-outline"></ion-icon>
  </ion-button>

When I put the ion-button inside the ion-slides the buttons not appear.

1 post - 1 participant

Read full topic

Ionic Web App on Safari Flickers, Hides Elements

$
0
0

Hi all,

I am hoping for some help with a broad problem I’m having. I am experiencing a raft of visual errors on my Ionic web app on Safari with no apparent root cause.

My app is live at this URL: https://kaskacards.ca Normally signup would be required but to save the trouble, you can log in with these details:

Email: sockpuppet.gargoyle.plant@gmail.com
Password: hello-ionic

The problem seems to be that certain elements don’t appear when the page loads. It’s primarily graphical because the invisible elements still appear in the inspector. But it’s quite random which elements won’t appear. Every time I go to a new route within the app, something else fails to load. In some cases, the vanished elements will rapidly blink in and out of existence as I scroll.

Normally I would suspect an issue with my code but I have no idea where to look at this point. I have stripped things down as much as possible to a standard Ionic build. (I did try removing the background image.) What’s especially jarring is that Chrome doesn’t show any of these issues.

Obviously this isn’t some finicky annoyance. It makes the app unusable. Does anyone want to take a look at this app, or does anyone have experience with Safari that may help? Anything would be so much appreciated at this point.

1 post - 1 participant

Read full topic

Ionic-native/http setSSLCertMode

$
0
0

Hi, I’m trying to do a post to an https endpoint and I get the error

“ls connection could not be established: javax.net.ssl.sslhandshakeexception: java.security.cert.certpathvalidatorexception: trust anchor for certification path not found.”

I searched on google and I found this working solution
https://github.com/ashenwgt/ionic-capacitor-ssl-pinning

My question is:
the example use
@ionic-native/http”: “^5.9.0”,
“cordova-plugin-advanced-http”: “^2.1.1”,

and in the code use a
this.http.setSSLCertMode(‘pinned’)

In my project I use
@ionic-native/http": “^5.31.1”,
“cordova-plugin-advanced-http”: “^3.1.0”,

and there is no setSSLCertMode.

Is this method deplrecated?
Is there any alternative to do a post using a certificate?

Thanks

1 post - 1 participant

Read full topic

Ionic 5 conflict package.json

$
0
0

I am install any Cordova plugin after run ionic serve that time show error

[ng] An unhandled exception occurred: The target entry-point “@ionic-native/device” has missing dependencies:
[ng] - @ionic-native/core
[ng] See “C:\Users\abc\AppData\Local\Temp\ng-tieLfi\angular-errors.log” for further details.

[ERROR] ng has unexpectedly closed (exit code 127).

    The Ionic CLI will exit. Please check any output above for error details.

ionic info

Ionic:

   Ionic CLI                     : 6.13.1 (C:\Users\abc\AppData\Roaming\npm\node_modules\@ionic\cli)
   Ionic Framework               : @ionic/angular 5.6.3
   @angular-devkit/build-angular : 0.1102.6
   @angular-devkit/schematics    : 11.2.6
   @angular/cli                  : 11.2.6
   @ionic/angular-toolkit        : 3.1.1

Cordova:

   Cordova CLI       : 10.0.0
   Cordova Platforms : none
   Cordova Plugins   : no whitelisted plugins (1 plugins total)

Utility:

   cordova-res : not installed
   native-run  : not installed

System:

   Android SDK Tools : 26.1.1 (D:\android sdk\Sdk)
   NodeJS            : v14.16.0 (C:\Program Files\nodejs\node.exe)
   npm               : 6.14.11
   OS                : Windows 10

package.json

{
  "name": "demotest",
  "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": "~11.2.0",
    "@angular/core": "~11.2.0",
    "@angular/forms": "~11.2.0",
    "@angular/platform-browser": "~11.2.0",
    "@angular/platform-browser-dynamic": "~11.2.0",
    "@angular/router": "~11.2.0",
    "@ionic-native/device": "^5.31.1",
    "@ionic/angular": "^5.5.2",
    "rxjs": "~6.6.0",
    "tslib": "^2.0.0",
    "zone.js": "~0.10.2"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.1102.4",
    "@angular/cli": "~11.2.4",
    "@angular/compiler": "~11.2.0",
    "@angular/compiler-cli": "~11.2.0",
    "@angular/language-service": "~11.2.0",
    "@ionic/angular-toolkit": "^3.1.1",
    "@types/jasmine": "~3.6.0",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "^12.11.1",
    "codelyzer": "^6.0.0",
    "cordova-plugin-device": "^2.0.2",
    "jasmine-core": "~3.6.0",
    "jasmine-spec-reporter": "~5.0.0",
    "karma": "~5.2.0",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage": "~2.0.3",
    "karma-coverage-istanbul-reporter": "~3.0.2",
    "karma-jasmine": "~4.0.0",
    "karma-jasmine-html-reporter": "^1.5.0",
    "protractor": "~7.0.0",
    "ts-node": "~8.3.0",
    "tslint": "~6.1.0",
    "typescript": "~4.0.2"
  },
  "description": "An Ionic project",
  "cordova": {
    "plugins": {
      "cordova-plugin-device": {}
    }
  }
}

1 post - 1 participant

Read full topic


Prevent to refresh tab with leaflet map in tabbed react app

$
0
0

Hello everyone I am kind of new in react/ionic and I writing tab app with ionic/react with this version.

Ionic Framework : @ionic/react 5.2.2

As for the title I am writing an app using the ionic template tabbed app.
One of the tabs contain a leaflet map and all the time that I switch between tabs , the maps get reloaded.
I understand that this is the classic behaviour from ionic/react, but I would like to keep the map from being destroied and rendered again.
Also because I am trying to draw the route from point A to point B in the maps, so I want to avoid unuseful call to leaflet and draw all the route slowing down the render.
How I can achieve this ?
The map component is a functional component, which wait for the coordinates returned from a module outside of this component.
If you need to see the code, or any other information let me know :slight_smile:

1 post - 1 participant

Read full topic

Build Prod failed. Could not find cordova.js script tag. Plugin loading may fail

$
0
0

Could anyone suggest please, what is going wrong ? When I am running ionic cordova build ios --prod

I see white screen with errors…

TypeError: undefined is not a constructor (evaluating ‘new o.BehaviorSubject(!1)’)

Could not find cordova.js script tag. Plugin loading may fail.

But if I am running

ionic cordova build ios … everything is ok.

Ionic info:

Ionic:

Ionic CLI : 6.12.4 (/usr/local/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/angular 5.5.2
@angular-devkit/build-angular : 0.1000.8
@angular-devkit/schematics : 10.0.8
@angular/cli : 10.0.8
@ionic/angular-toolkit : 2.3.3

Cordova:

Cordova CLI : 10.0.0
Cordova Platforms : none
Cordova Plugins : no whitelisted plugins (0 plugins total)

Utility:

cordova-res : not installed
native-run : not installed

System:

ios-deploy : 1.11.3
ios-sim : 8.0.2
NodeJS : v14.15.4 (/usr/local/bin/node)
npm : 6.14.10
OS : macOS Big Sur
Xcode : Xcode 12.4 Build version 12D4e

1 post - 1 participant

Read full topic

Creating favorite list in Ionic5 for four separate categories

$
0
0

Hi, I am trying to get help with populating a favorites page (list of favored items) in Ionic5 app. It has tabs for films, people, planets and starships and a favorite service for all. I’ve created a new tab for favorites, and so far got it working for films only and unsure how to populate it for the people, planets and starships, which I also want to add. I’ve spent a lot of time researching this but unable to solve it.

Below is the code for favorites.page.ts, which only populates data for films.

import { Component, OnInit } from '@angular/core';
import { Storage } from '@ionic/storage';
import { FavoriteService } from '../../services/favorite.service';
import { ApiService } from '../../services/api.service';
import { forkJoin } from 'rxjs';

@Component({
  selector: 'app-favorites',
  templateUrl: './favorites.page.html',
  styleUrls: ['./favorites.page.scss'],
})
export class FavoritesPage implements OnInit {
  films = [];

  constructor(private storage: Storage, private favService: FavoriteService, private apiService: ApiService) { }

  ngOnInit() {
    this.favService.getAllFavoriteFilms().then(data => {
      console.log('favs: ', data); // ["1", "5", "3"]
      this.loadFilmData(data);
    });
  }

  loadFilmData(favFilms: string[]) {
    const observables = [];

    // Create an API call for every saved movie ID
    for (let id of favFilms) {
      observables.push(this.apiService.getFilm(id));
    }

    // Wait until all observables are finished
    forkJoin(observables).subscribe(result => {
      console.log('filmd data: ', result);
      this.films = result;
    })
  }
}

Below is favorites.page.html, which shows favorite films.

<ion-header>
  <ion-toolbar id="color">
  </ion-toolbar>
</ion-header>

<ion-content>
  <h1 class="title">Favorite Films</h1>

  <ion-item *ngFor="let f of films">
    <ion-label>
      {{ f.title }}
    </ion-label>
  </ion-item>

  <h1 class="title">Favorite People</h1>

  <ion-item *ngFor="let p of planets">
    <ion-label>
      {{ p.name }}
    </ion-label>
  </ion-item>

  <h1 class="title">Favorite Planets</h1>

  <ion-item *ngFor="let p of planets">
    <ion-label>
      {{ p.name }}
    </ion-label>
  </ion-item>

  <h1 class="title">Favorite Starships</h1>

  <ion-item *ngFor="let p of planets">
    <ion-label>
      {{ p.name }}
    </ion-label>
  </ion-item>
</ion-content>

This is the favorite.service.ts below.

import { Injectable } from '@angular/core';
import { Storage } from '@ionic/storage';

const STORAGE_KEY  = 'favoriteFilms';
const PLANETS_KEY = 'favoritePlanets';
const PEOPLE_KEY = 'favoritePeople';
const STARSHIPS_KEY = 'favoritesStarships';

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

  constructor(private storage: Storage) {
  }
 
  getAllFavoriteFilms() {
    return this.storage.get(STORAGE_KEY);
  }

  getAllFavoritePeople() {
    return this.storage.get(STORAGE_KEY);
  }

  getAllFavoritePlanets() {
    return this.storage.get(STORAGE_KEY);
  }

  getAllFavoriteStarships() {
    return this.storage.get(STORAGE_KEY);
  }
  
  isFavorite(filmId) {
    return this.getAllFavoriteFilms().then(result => {
      return result && result.indexOf(filmId) !== -1;
    });
  }

  isFavorite1(personId) {
    return this.getAllFavoritePeople().then(result => {
      return result && result.indexOf(personId) !== -1;
    });
  }

  isFavorite2(planetId) {
    return this.getAllFavoritePlanets().then(result => {
      return result && result.indexOf(planetId) !== -1;
    });
  }

  isFavorite3(starshipId) {
    return this.getAllFavoriteStarships().then(result => {
      return result && result.indexOf(starshipId) !== -1;
    });
  }

  favoriteFilm(filmId) {
    return this.getAllFavoriteFilms().then(result => {
      result = result || [];
      result.push(filmId);
      return this.storage.set(STORAGE_KEY, result);
    });
  }

  favoritePerson(personId) {
    return this.getAllFavoritePeople().then(result => {
      result = result || [];
      result.push(personId);
      return this.storage.set(STORAGE_KEY, result);
    });
  }

  favoritePlanet(planetId) {
    return this.getAllFavoritePlanets().then(result => {
      result = result || [];
      result.push(planetId);
      return this.storage.set(STORAGE_KEY, result);
    });
  }

  favoriteStarship(starshipId) {
    return this.getAllFavoriteStarships().then(result => {
      result = result || [];
      result.push(starshipId);
      return this.storage.set(STORAGE_KEY, result);
    });
  }

  unfavoriteFilm(filmId) {
    return this.getAllFavoriteFilms().then(result => {
      if (result) {
        var index = result.indexOf(filmId);
        result.splice(index, 1);
        return this.storage.set(STORAGE_KEY, result);
      }
    });
  }

  unfavoritePerson(personId) {
    return this.getAllFavoriteFilms().then(result => {
      if (result) {
        var index = result.indexOf(personId);
        result.splice(index, 1);
        return this.storage.set(STORAGE_KEY, result);
      }
    });
  }

  unfavoritePlanet(planetId) {
    return this.getAllFavoritePlanets().then(result => {
      if (result) {
        var index = result.indexOf(planetId);
        result.splice(index, 1);
        return this.storage.set(STORAGE_KEY, result);
      }
    });
  }

  unfavoriteStarship(starshipId) {
    return this.getAllFavoriteStarships().then(result => {
      if (result) {
        var index = result.indexOf(starshipId);
        result.splice(index, 1);
        return this.storage.set(STORAGE_KEY, result);
      }
    });
  }   
}

And this is the api.service.ts

import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';

@Injectable({
  providedIn: 'root'
})
export class ApiService {
 
  constructor(private http: HttpClient) { }

  getFilms() {
    return this.http.get('https://swapi.dev/api/films');
  }
 
  getFilm(id) {
    return this.http.get(`https://swapi.dev/api/films/${id}`);
  }

  getPlanets() {
    return this.http.get('https://swapi.dev/api/planets');
  }
  
  getPlanet(id) {
    return this.http.get(`https://swapi.dev/api/planets/${id}`);
  }
  
  getStarships() {
    return this.http.get('https://swapi.dev/api/starships');
  }
 
  getStarship(id) {
    return this.http.get(`https://swapi.dev/api/starships/${id}`);
  }

  //referred to code below from https://github.com/herbae/starwarsapp, for some of the code on this page
  
  getPeople() {
    return this.http.get('https://swapi.dev/api/people');
  }

  getPerson(id) {
    return this.http.get(`https://swapi.dev/api/people/${id}`);
  }

}

So what I need to do is add favorite data for the other 3 categories (people, planets, starships), so as they will display under films favorites, all in one page. This is a snapshot of how it should look, but can only get films data to display.

1 post - 1 participant

Read full topic

Ionic app accidently closed by hardware back button

$
0
0

I am using fcm push notification. After click on notification (when app is in background), i did route to component inside platform ready. When i pressed the hardware back button instead of going to previous page, it accidently closes the app (ion back button worked properly here).
Also hardware back button not listening to any related events like this.platform.backButton.subscribeWithPriority(). Need the assistance as it is the major bug and crashes the app. If there is alternative to navigate fcm push notification, please suggest.

1 post - 1 participant

Read full topic

Undesired border around ion-button

$
0
0

Hello guys,

Im using ion-button component and i changed its default border radius. Everything is fine with button until i put some type on it. Example if i set its type to submit or button it will get some border around it and i dont know where this is comming from. Also when i view application in web there is no such border but when i open it in my android phone there is this border i dont want.

Any ideas? I searched google but i only get solutions for removing border when button is active but this is not case in my problem.

1 post - 1 participant

Read full topic

Viewing all 49268 articles
Browse latest View live


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