-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integrate V5 in angular #769
Comments
In app.module.ts import { NgModule, /** ADD THIS -> **/ CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
@NgModule({
declarations: [...],
entryComponents: [...],
imports: [...],
exports: [...],
providers: [...],
schemas: [CUSTOM_ELEMENTS_SCHEMA] /** 👈🏻 ADD THIS **/
})
export AppModule {} in src\index.html <body>
<app-root></app-root>
<script src="https://unpkg.com/ionicons@5.0.0/dist/ionicons.js"></script>
</body> Recompile/ Re-serve |
Thanks for the answer that works but is there a way to use it this way? |
While this works, it is not the Angular way to include scripts into index.html. I hope there is a cleaner way. Does this mean we need to change all to <ion-icon name="xx", hence a lot of breaking change for non-Ionic projects? |
As @bleuscyther mentions, you can integrate the script in your Number 2) can be fixed by locally installing Ionicons 5 with npm. But data within This can be achieved as follows by modifying
Then just link in Number 1) seems to be tricky. After following the guide about integrating Stencil into an Angular app, I found that this approach works. Open
This will basically tell the Ionicons script to look for the Anyway, all you then have to do is make sure that the
This will only copy the |
import * as icons from 'ionicons/icons';
import { DomSanitizer } from '@angular/platform-browser';
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'page-icons',
templateUrl: './icons.component.html',
})
export class IconsComponent implements OnInit {
icons: = icons;
constructor(private domSanitizer: DomSanitizer) {}
} <img [src]="domSanitizer.bypassSecurityTrustUrl(newIcons.heart)"> But can't control icon's (image) color. |
The color seems like a separate issue (#784 ) It works for icons that do not have a hard-coded stroke color. |
When I do this, I do see the icon using Any idea how to fix it? |
Doesn’t the second post in this issue fix it? It did for me. |
Yeah, it worked. But I think this is still not ready for using in the latest angular. |
The solution from @bleuscyther works fine, but mine not, which I consider the same, but from local
Got this error instead:
|
Just add this to the assets in angular.json, and everything works.
|
Well now v5 didnt have scss so what is the correct way to integrate and consume this in angular ?
The text was updated successfully, but these errors were encountered: