Skip to content
This repository has been archived by the owner on May 4, 2022. It is now read-only.

background image in ngStyle does not display on iPhone devices #387

Open
ionitron-bot bot opened this issue Nov 29, 2018 · 0 comments
Open

background image in ngStyle does not display on iPhone devices #387

ionitron-bot bot opened this issue Nov 29, 2018 · 0 comments
Labels

Comments

@ionitron-bot
Copy link

ionitron-bot bot commented Nov 29, 2018

Original issue by @MasonBrady54 on 2018-07-20T18:15:33Z

Bug Report

Ionic Info

cli packages: (C:\Users\Gosu\AppData\Roaming\npm\node_modules)

    @ionic/cli-utils  : 1.19.2
    ionic (Ionic CLI) : 3.20.0

global packages:

    cordova (Cordova CLI) : 8.0.0

local packages:

    @ionic/app-scripts : 3.1.9
    Cordova Platforms  : none
    Ionic Framework    : ionic-angular 3.9.2

System:

    Node : v8.11.2
    npm  : 6.1.0
    OS   : Windows 10

Environment Variables:

    ANDROID_HOME : not set

Misc:

    backend : pro

Describe the Bug
Having a dynamic background image which is set using ngStyle in the html code does not display the image on actual iPhone devices. (the following code works on Android devices, Android emulators and ionic lab)

[ngStyle] = "{'background': 'url(../assets/img/backgrounds/'+currentTheme+'.jpg)'}"> 

Steps to Reproduce
Steps to reproduce the behavior:

  1. Create a sample page.
  2. Paste an image in src/assets/img/backgrounds/ folder of your project.
  3. In the .ts file of your panel create a variable which holds the name of the image you just pasted in the following folder. E.g. private myDynamicImageName = "myImageName"
  4. In the .html file of your panel add the following code to a div element:
    [ngStyle] = "{'background': 'url(../assets/img/backgrounds/'+myDynamicImageName+'.jpg)'}">
  5. Test on both Android and iOS devices. The image will successfully load on a Android device but will not display on a iOS device.
    The code above works for all EMULATORS. Test on real iOS devices is required to reproduce bug.

Expected Behavior
The expected behavior should make the following code provided above to work for both iOS and Android devices. Currently it works only on Android devices.

Additional Context
Please, if someone has already encountered this issue and found an actual solution, share your solution here in order to solve this issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

0 participants