marcuscalidus / ts-material-icons-svg Goto Github PK
View Code? Open in Web Editor NEWAttempt to make the latest Material Icons SVG designs available in typescript
License: Apache License 2.0
Attempt to make the latest Material Icons SVG designs available in typescript
License: Apache License 2.0
Hi,
When I use the
import { icon_x } from 'ts-material-icons-svg/dist/outline'
format and run ng build --prod
, the output folder has hundreds of svg icons in the root.
I tried using the other syntax
import icon_x from 'ts-material-icons-svg/svg/outline/x.svg'
and get an error when MatIconRegistry tries to create the reference because the value of .url
is undefined.
In both cases, I am using this code:
const iconsToImport = [{ name: 'x', url: icon_x }];
...
export class AppModule {
constructor(matIconRegistry: MatIconRegistry, domSanitizer: DomSanitizer) {
iconsToImport.forEach(icon => {
matIconRegistry.addSvgIcon(
icon.name,
domSanitizer.bypassSecurityTrustResourceUrl(icon.url)
);
});
}
}
The error shown is:
Error: The URL provided to MatIconRegistry was not trusted as a resource URL via Angular's DomSanitizer. Attempted URL was "SafeValue must use [property]=binding: undefined (see http://g.co/ng/security#xss)".
at getMatIconFailedToSanitizeUrlError (icon.es5.js:50)
at MatIconRegistry.push
What am I doing wrong in both cases? TIA
I dont understand the documentation regarding jest tests - i get a lot of errors regarding icons. Starting with:
console.error ERROR Error: Error retrieving icon :keyboard_arrow_left! Unable to find icon with the name ":keyboard_arrow_left" at SafeSubscriber._error (/Users/bjoernwiegell/programmering/angproj/monorepo/packages/src/material/icon/icon.ts:435:44)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.