i am using Angular standalone component, version of ionic is 7.1.1 / version of Angular: 17.0.8.
this is the html:
<div id="container">
<strong>{{ name }}</strong>
<div class="icon-container">
<p>Windows Shop</p>
<div class="win-icon">
<ion-icon name="logo-windows"></ion-icon>
</div>
</div>
</div>
and this is the ts class:
import { Component, Input } from '@angular/core';
import { IonIcon } from '@ionic/angular/standalone';
import { CommonModule } from '@angular/common';
import {logoWindows} from 'ionicons/icons';
@Component({
selector: 'app-explore-container',
templateUrl: './explore-container.component.html',
styleUrls: ['./explore-container.component.scss'],
imports: [IonIcon],
standalone: true,
})
export class ExploreContainerComponent {
@Input() name?: string;
constructor(){
addIcons:{{logoWindows}}
}
}
As said the ion-icon is not displayed and this is the error in the browser console:
index.js:32 Uncaught TypeError: Failed to construct 'URL': Invalid base URL
at getAssetPath (index.js:32:22)
at getNamedUrl (icon.js:46:22)
at getUrl (icon.js:27:12)
at Icon.loadIcon (icon.js:296:25)
at icon.js:257:18
at Icon.waitUntilVisible (icon.js:291:13)
at Icon.connectedCallback (icon.js:255:14)
at Icon.connectedCallback (index.js:3390:43)
at DefaultDomRenderer2.insertBefore (platform-browser.mjs:563:26)
at nativeInsertBefore (core.mjs:8495:14)
index.js:32 Uncaught TypeError: Failed to construct 'URL': Invalid base URL
at getAssetPath (index.js:32:22)
at getNamedUrl (icon.js:46:22)
at getUrl (icon.js:27:12)
at Icon.loadIcon (icon.js:296:25)
at icon.js:257:18
at Icon.waitUntilVisible (icon.js:291:13)
at Icon.connectedCallback (icon.js:255:14)
at Icon.connectedCallback (index.js:3390:43)
at StackController.transition (ionic-angular-common.mjs:1351:29)
at ionic-angular-common.mjs:1242:29
src_app_tab1_tab1_page_ts.js:2 TypeError: Failed to construct 'URL': Invalid base URL
at getAssetPath (index.js:32:22)
at getNamedUrl (icon.js:46:22)
at getUrl (icon.js:27:12)
at Icon.loadIcon (icon.js:296:25)
at Icon.componentDidLoad (icon.js:268:18)
at safeCall (index.js:2389:36)
at postUpdateComponent (index.js:2299:13)
at index.js:2207:9
at Generator.next (<anonymous>)
at asyncGeneratorStep (asyncToGenerator.js:3:1) undefined
By the way i tried to install the latest ionic version with the following command : npm install -g @ionic/cli@latest but it keeps the current version which is : 7.1.1
What do you suggest?
constructor
{{ logoWindows }}? – Reputed