Summary

This chapter guided us through the options available in Angular 2 for creating powerful APIs for our components, so we can provide high levels of interoperability between components, configuring its properties by assigning either static values or managed bindings. We also saw how a component can act as a host component for another child component, instantiating the former's custom element in its own template, setting the ground up for larger component trees in our applications. Output parameters give the layer of interactivity we need by turning our components into event emitters so they can properly communicate in an agnostic fashion with any parent component that might eventually host them. Template references paved the way to create references in our custom elements that we can use as accessors to their properties and methods from within the template in a declarative fashion. We also discussed how we could isolate the component's HTML template in an external file in order to ease its future maintainability and how to do the same with any style sheet we wanted to bind to the component, in case we do not want to bundle the component styles inline. An overview of the built-in features for handling view encapsulation in Angular 2 gave us some additional insights on how we can benefit from Shadow DOM's CSS scoping on a per component basis and how we can polyfill it when not supported.

We still have much more to learn regarding template management in Angular 2, mostly with regards to the two concepts that you will use extensively along your journey with Angular. I am referring to Directives and Pipes, which we will cover extensively in Chapter 4, Enhancing our Components with Pipes and Directives.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.129.243.15