so that these Angular elements can be combined in such a way that all elements can be related with each other and ultimately create an application. This command will add the @angular/elements packages and everything it needs to make web components including document-register-element, which is a lightweight version of the W3C Custom Elements specification. )To create a custom element, you simply need to create an ES6 class that extends from an HTML element and register that class with the browser through an API called the The Angular Elements library is essentially a bridge between Angular components and the custom web elements API. We have multiple inputs that we have written in the HTML file, but we still need to define them inside the I have created these extra inputs for the future purposes, but our component is now ready! Replace what's in the The above code is very straightforward if you've done much Angular at all. The only place that has never had a good story for reusing code is in HTML. Angular (2+) is a much more robust framework and was designed as a tool to build complete, full-featured applications. There is a problem with this package, however. In short, you're able to create custom DOM elements that have their own functionality that the rest of the page doesn't need to know anything about. The next thing to do is to tell Angular that the components we want to build as custom elements are Then we ask Angular to actually create and define those custom elements as follows in the At this point, we’re pretty much all set. It is just displaying the login form if the user is not logged in and a welcome message if they are. This is the reason that every framework for developing software has a way to encapsulate functionality and reuse it. Now enhanced with:Angular is awesome. The flexibility of custom elements means there is a dizzying array of possibilities to use your Angular code across teams, frameworks, and even technologies. First, you've set the encapsulation for the component to Next, you'll need the actual HTML elements for the component. Until now.You'll need just a few things installed to get started with Angular Elements:While it's not necessary, I'm using Visual Studio Code. To get started, you'll need to create an OpenID Connect application in Okta.Once you've logged in and landed on the dashboard page, copy down the Org URL pictured below. You'll want to install a simple HTTP server. That project is going to be the place where we create custom elements before we compile them to code that can be shipped in any web application. Wouldn't it be nice, though, to be able to use Angular in different contexts without all of the overhead? You can find the code for the example used in that post here:If you have any question, feel free to reach out to me. But I want to talk about another feature of Angular that was added to it in version 6. Select the default answer by hitting the The CLI installs the necessary Angular packages and dependencies in a folder called As you can see, the app contains already contains a few things that we can display on the screen. Our custom element will get displayed on the screen when we click that button.Another benefit of creating custom elements is that they can be compiled into standalone script files that can then be added to different frontend frameworks. In this angular step by step tutorial we went from the basic concepts and why's of Angular Framework to building a complete Angular app using Angular Material components. But first, let's take a look at why you should use Angular Elements. In the future, though, I'm sure there will be a CLI schematic for Angular Elements that generates a flat file structure and bundles into one file. You can add multiple instances of this element to do the DOM with different name inputs. As you can see, Angular was purposefully designed to interface easily with the DOM API, and custom elements are no exception.Angular Elements also let us take advantage of Angular's dependency injection. The login form's button calls the Now you've got a component. Now we need to package it up so that it can be used elsewhere with a script tag. ?Angular Elements also allows you to develop and publish parts of the application independently!These are just some of the things that first drew me towards Angular Elements. I hope it helped you understand how to use Angular Elements in your Angular applications. In other words, whenever we create an Angular Element, we create a new custom HTML element that can be used on any webpage, even if that webpage does not use Angular at all. So let’s continue exploring the uses of Angular Elements in the Part 2 of this series:Thank you for reading this really, really long post.