Skip to content
This repository was archived by the owner on Feb 6, 2024. It is now read-only.

web-photo-filter tag is not rendering on iOS 15 device Ionic 6 #31

@aliexalter

Description

@aliexalter

Platform iOS
Ionic 6 Capacitor Angular 11

After running ionic cap sync. When app is run on Xcode > Device it does not show web-photo-filter tag. Only show img tag.

photoToFilter.thumbnail is base64 image stored in local storage.

PROBLEM: E/Capacitor: Unable to open asset URL: http://localhost/webphotofilter.js

app/index.html
<script async src="webphotofilter.js"></script>

angular.json

`{
                "glob": "webphotofilter.js",
                "input": "node_modules/web-photo-filter/dist",
                "output": "./"
              },
              {
                "glob": "webphotofilter/*",
                "input": "node_modules/web-photo-filter/dist",
                "output": "./"
              }`

app/main.ts

`import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';

import { AppModule } from './app/app.module';
import { environment } from './environments/environment';

import { defineCustomElements } from "@ionic/pwa-elements/loader";

if (environment.production) {
  enableProdMode();
}

platformBrowserDynamic().bootstrapModule(AppModule)
  .catch(err => console.log(err));

//Call the elemnt loader after the platform has been bootstrapped
defineCustomElements(window);`

imagefiltering.module.ts

`import { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';

import { IonicModule } from '@ionic/angular';

import { ImagefilteringPageRoutingModule } from './imagefiltering-routing.module';

import { ImagefilteringPage } from './imagefiltering.page';
import { SwiperModule } from 'swiper/angular';

@NgModule({
  imports: [
    CommonModule,
    FormsModule,
    IonicModule,
    SwiperModule,
    ImagefilteringPageRoutingModule
  ],
  declarations: [ImagefilteringPage],
  schemas: [CUSTOM_ELEMENTS_SCHEMA]
})
export class ImagefilteringPageModule {}
`

imagefiltering.page.ts

`import { Component, OnInit } from '@angular/core';
import { Storage } from '@capacitor/storage';

@Component({
  selector: 'app-imagefiltering',
  templateUrl: './imagefiltering.page.html',
  styleUrls: ['./imagefiltering.page.scss'],
})
export class ImagefilteringPage implements OnInit {

  product:any;
  photoTofilter:any = {
    thumbnail: ""
  };

  constructor() { }

  ngOnInit() {
  }

  ionViewDidEnter(){
    Storage.get({key: 'product'}).then((result:any)=>{
      if(result && result.value)
      {
         this.product = JSON.parse(result.value);
      }
    });
    Storage.get({key: 'editImage'}).then((result:any)=>{
      if(result && result.value)
      {
         this.photoTofilter = JSON.parse(result.value);
      }
    });
  }

}
`

imagefiltering.page.html

`<ion-header>
  <ion-toolbar mode="ios">
    <ion-buttons slot="start">
      <ion-back-button text="" icon="chevron-back" defaultHref="/selection/device" color="medium"></ion-back-button>
    </ion-buttons>
    <ion-title>Apply Filter</ion-title>
  </ion-toolbar>
</ion-header>

<ion-content>
  <ion-grid>
    <ion-row>
      <ion-col>
        <img [src]="photoTofilter.thumbnail"/>
        <web-photo-filter [src]="photoTofilter.thumbnail" filter="sepia"></web-photo-filter>
      </ion-col>
    </ion-row>
  </ion-grid>
</ion-content>

<ion-footer>
  <swiper [spaceBetween]="10" [slidesPerView]="'auto'" [centeredSlides]="true" [loop]="true">
    <ng-template swiperSlide>
      <img [src]="photoTofilter.thumbnail"/>
    </ng-template>
    <ng-template swiperSlide>
      <web-photo-filter [src]="photoTofilter.thumbnail" filter="sepia"></web-photo-filter>
    </ng-template>
  </swiper>
</ion-footer>
`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions