ngx-materialize icon indicating copy to clipboard operation
ngx-materialize copied to clipboard

Icons do not load

Open kalypzo opened this issue 8 years ago • 6 comments

Expected Behavior

When applying tag <i mz-icon class="col s12 m2" [icon]="'cloud'"></i>, an icon should show

Current Behavior

No icon shows.

Possible Solution

Make sure to include the following in your index.html: <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> There was no mention of this in the initial setup documentation. I couldn't figure out why I couldn't get the icons to work. Finally came across a post somewhere else that mentioned this. Posting this in case someone runs into the same issue I did.

kalypzo avatar Dec 19 '17 05:12 kalypzo

@kalypzo it is mentioned in the README file under the installation section and marked as optional:

npm install --save ng2-materialize
npm install --save mdi    #optional

.angular-cli.json

"styles": [
  "styles.scss",
+ "../node_modules/materialize-css/dist/css/materialize.min.css",
+ "../node_modules/mdi/css/materialdesignicons.min.css"   #optional
]

LiadIdan avatar Dec 19 '17 08:12 LiadIdan

@LiadIdan the mention is for Material Design Icons (community project based on Google Material Icons) which should be used with mz-icon-mdi directive but I believe @kalypzo pointed out that we have no mention how to include Material Icons (Google Material Icons) when using mz-icon directive.

jfcere avatar Dec 19 '17 14:12 jfcere

@jfcere I just realized that it's two separate packages :sweat_smile:

LiadIdan avatar Dec 19 '17 14:12 LiadIdan

@LiadIdan don't worry ... it is not that obvious :)

jfcere avatar Dec 19 '17 14:12 jfcere

I just realized I shouldn't need to use the link href. However, I did follow the instructions with npm install and the angular-cli.json, it just won't work. However, it does work in the sample project, but it's using an older version of the angular-cli. Maybe I need to downgrade? Everything in my package.json, angular-cli.json, tsconfig.json, and tsconfig.app.json matches. Will troubleshoot further and let you know my findings.

kalypzo avatar Dec 19 '17 15:12 kalypzo

@kalypzo no you are right, you do need to use the link.

The sample project uses it, you can see it here: https://github.com/sherweb/ng2-materialize/blob/master/demo-app/src/index.html#L11

jfcere avatar Dec 19 '17 15:12 jfcere