GithubHelp home page GithubHelp logo

marcuscalidus / ts-material-icons-svg Goto Github PK

View Code? Open in Web Editor NEW
6.0 6.0 4.0 1.12 MB

Attempt to make the latest Material Icons SVG designs available in typescript

License: Apache License 2.0

JavaScript 0.03% Shell 47.70% Roff 0.06% TypeScript 52.21%

ts-material-icons-svg's People

Contributors

marcuscalidus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

ts-material-icons-svg's Issues

Importing everything...

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

Jest test

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.