O'Reilly logo

Mastering Angular Components by Gion Kunz

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Building SVG components

When building Angular components with SVG templates, there are a couple of things that you need to be aware of. The first and most obvious one is XML namespaces. Modern browsers are very intelligent when parsing HTML. Besides being probably the most fault-tolerant parsers in the history of computer science, DOM parsers are very smart in recognizing markup, and then deciding how to treat it. They will automatically decide the correct namespaces for us, based on element names, so we don't need to deal with them when writing HTML.

If you've messed around with the DOM API a bit, you've probably recognized that there are two methods for creating new elements. In the document object, for example, there's a createElement ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required