2015-11-06 07:26:24 -05:00
|
|
|
|
@cheatsheetSection
|
|
|
|
|
Component configuration
|
|
|
|
|
@cheatsheetIndex 5
|
2015-11-05 10:04:55 -05:00
|
|
|
|
@description
|
2015-11-06 07:26:24 -05:00
|
|
|
|
`@Component` extends `@Directive`,
|
|
|
|
|
so the `@Directive` configuration applies to components as well
|
2015-11-05 10:04:55 -05:00
|
|
|
|
|
|
|
|
|
@cheatsheetItem
|
|
|
|
|
`viewProviders: [MyService, provide(...)]`|`viewProviders:`
|
|
|
|
|
Array of dependency injection providers scoped to this component's view.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@cheatsheetItem
|
2015-11-06 07:26:24 -05:00
|
|
|
|
`template: 'Hello {{name}}'
|
|
|
|
|
templateUrl: 'my-component.html'`|`template:`|`templateUrl:`
|
2015-11-05 10:04:55 -05:00
|
|
|
|
Inline template / external template url of the component's view.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@cheatsheetItem
|
2015-11-06 07:26:24 -05:00
|
|
|
|
`styles: ['.primary {color: red}']
|
|
|
|
|
styleUrls: ['my-component.css']`|`styles:`|`styleUrls:`
|
2015-11-05 10:04:55 -05:00
|
|
|
|
List of inline css styles / external stylesheet urls for styling component’s view.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@cheatsheetItem
|
|
|
|
|
`directives: [MyDirective, MyComponent]`|`directives:`
|
|
|
|
|
List of directives used in the the component’s template.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@cheatsheetItem
|
|
|
|
|
`pipes: [MyPipe, OtherPipe]`|`pipes:`
|
|
|
|
|
List of pipes used in the component's template.
|