Using `templateUrl` with a `.svg` file
See original GitHub issueHey 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:
- Created 5 years ago
- Reactions:10
- Comments:16 (9 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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
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.