component-overview.md (angular-11.0.1) | : | component-overview.md (angular-11.0.2) | ||
---|---|---|---|---|
skipping to change at line 113 | skipping to change at line 113 | |||
1. Add a `class` statement that includes the code for the component. | 1. Add a `class` statement that includes the code for the component. | |||
<code-example | <code-example | |||
path="component-overview/src/app/component-overview/component-overview.c omponent.ts" | path="component-overview/src/app/component-overview/component-overview.c omponent.ts" | |||
region="class"> | region="class"> | |||
</code-example> | </code-example> | |||
## Specifying a component's CSS selector | ## Specifying a component's CSS selector | |||
Every component requires a CSS _selector_. A selector instructs Angular to insta ntiate this component wherever it finds the corresponding tag in template HTML. For example, consider a component, `hello-world.component.ts` that defines its s elector as `app-hello-world`. This selector instructs angular to instantiate thi s component any time the tag, `<app-hello-world>` in a template. | Every component requires a CSS _selector_. A selector instructs Angular to insta ntiate this component wherever it finds the corresponding tag in template HTML. For example, consider a component `hello-world.component.ts` that defines its se lector as `app-hello-world`. This selector instructs Angular to instantiate this component any time the tag `<app-hello-world>` appears in a template. | |||
To specify a component's selector, add a `selector` statement to the `@Component ` decorator. | Specify a component's selector by adding a `selector` statement to the `@Compone nt` decorator. | |||
<code-example | <code-example | |||
path="component-overview/src/app/component-overview/component-overview.compo nent.ts" | path="component-overview/src/app/component-overview/component-overview.compo nent.ts" | |||
region="selector"> | region="selector"> | |||
</code-example> | </code-example> | |||
## Defining a component's template | ## Defining a component's template | |||
A template is a block of HTML that tells Angular how to render the component in your application. | A template is a block of HTML that tells Angular how to render the component in your application. | |||
You can define a template for your component in one of two ways: by referencing an external file, or directly within the component. | You can define a template for your component in one of two ways: by referencing an external file, or directly within the component. | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added |