question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Using `templateUrl` with a `.svg` file

See original GitHub issue

Hey friendly @angular/cli team!

Would there be any appetite to enable using a .svg file as a component template?

As far as I can tell it would be a small change in webpack-config/common.js from:

{ test: /\.html$/, loader: 'raw-loader' },
{ test: /\.(eot|svg|cur)$/, // ...

to

{ test: /\.(html|svg)$/, loader: 'raw-loader' },
{ test: /\.(eot|cur)$/, // ...

Are there any downsides to this? Are there any other places that the change would need to be handled? It seems to work when I change it in my node_modules.

Let me know if this is something that would be useful/wanted, and I’ll make a PR.

Thanks!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:10
  • Comments:16 (9 by maintainers)

github_iconTop GitHub Comments

4reactions
oocxcommented, Mar 9, 2019

With Angular CLI 8.0.0-beta.5, you can now use .svg files as templates. You can read more about the new feature in my blog on medium: https://medium.com/@oocx/using-svg-files-as-component-templates-with-angular-cli-ea58fe79b6c1

0reactions
angular-automatic-lock-bot[bot]commented, Sep 9, 2019

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pass Angular component selector having svg file as ...
Now I need to pass abc-svg selector and other svg selectors to shared-component. It can be done using *ngIf, along passing svg name...
Read more >
SVG as templates - Angular
You can use SVG files as templates in your Angular applications. When you use an SVG as the template, you are able to...
Read more >
SVG as Templates - Angular 11 - W3cubDocs
You can use SVG files as templates in your Angular applications. When you use an SVG as the template, you are able to...
Read more >
Using svg files as component templates with Angular CLI
Using svg files as component templates with Angular CLI. Use .svg graphics as component templates to dynamically generate interactive graphics.
Read more >
Angular Svg Template Bindings - StackBlitz
import { Component } from "@angular/core";. @Component({. selector: "app-root",. templateUrl: "./app.component.html",. styleUrls: ["./app.component.css"]. }).
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found