2015-11-06 12:26:24 +00:00
|
|
|
|
@cheatsheetSection
|
|
|
|
|
|
Component configuration
|
2016-08-09 00:18:50 +00:00
|
|
|
|
@cheatsheetIndex 7
|
2015-11-05 15:04:55 +00:00
|
|
|
|
@description
|
2015-12-13 03:17:26 +00:00
|
|
|
|
{@target js}`ng.core.Component` extends `ng.core.Directive`,
|
|
|
|
|
|
so the `ng.core.Directive` configuration applies to components as well{@endtarget}
|
2016-08-30 01:12:51 +00:00
|
|
|
|
{@target ts}`@Component` extends `@Directive`,
|
2015-12-13 03:17:26 +00:00
|
|
|
|
so the `@Directive` configuration applies to components as well{@endtarget}
|
2015-11-05 15:04:55 +00:00
|
|
|
|
|
2016-08-02 14:34:04 +00:00
|
|
|
|
@cheatsheetItem
|
2016-08-30 01:12:51 +00:00
|
|
|
|
syntax:
|
2016-08-02 14:34:04 +00:00
|
|
|
|
`moduleId: module.id`|`moduleId:`
|
|
|
|
|
|
description:
|
2016-08-30 01:12:51 +00:00
|
|
|
|
If set, the `templateUrl` and `styleUrl` are resolved relative to the component.
|
2016-08-02 14:34:04 +00:00
|
|
|
|
|
2015-11-05 15:04:55 +00:00
|
|
|
|
@cheatsheetItem
|
2016-08-30 01:12:51 +00:00
|
|
|
|
syntax(ts):
|
2016-06-15 22:11:39 +00:00
|
|
|
|
`viewProviders: [MyService, { provide: ... }]`|`viewProviders:`
|
2015-12-13 03:17:26 +00:00
|
|
|
|
syntax(js):
|
2016-06-15 22:11:39 +00:00
|
|
|
|
`viewProviders: [MyService, { provide: ... }]`|`viewProviders:`
|
2015-12-09 12:33:42 +00:00
|
|
|
|
description:
|
2016-09-01 19:06:42 +00:00
|
|
|
|
List of dependency injection providers scoped to this component's view.
|
2015-11-05 15:04:55 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@cheatsheetItem
|
2015-12-09 12:33:42 +00:00
|
|
|
|
syntax:
|
2015-11-06 12:26:24 +00:00
|
|
|
|
`template: 'Hello {{name}}'
|
|
|
|
|
|
templateUrl: 'my-component.html'`|`template:`|`templateUrl:`
|
2015-12-09 12:33:42 +00:00
|
|
|
|
description:
|
2016-08-30 01:12:51 +00:00
|
|
|
|
Inline template or external template URL of the component's view.
|
2015-11-05 15:04:55 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@cheatsheetItem
|
2015-12-09 12:33:42 +00:00
|
|
|
|
syntax:
|
2015-11-06 12:26:24 +00:00
|
|
|
|
`styles: ['.primary {color: red}']
|
|
|
|
|
|
styleUrls: ['my-component.css']`|`styles:`|`styleUrls:`
|
2015-12-09 12:33:42 +00:00
|
|
|
|
description:
|
2016-08-30 01:12:51 +00:00
|
|
|
|
List of inline CSS styles or external stylesheet URLs for styling the component’s view.
|