angular-cn/docs/content/cheatsheet/component-configuration.md

39 lines
1.1 KiB
Markdown
Raw Normal View History

2015-11-06 07:26:24 -05:00
@cheatsheetSection
Component configuration
@cheatsheetIndex 7
2015-11-05 10:04:55 -05:00
@description
{@target js}`ng.core.Component` extends `ng.core.Directive`,
so the `ng.core.Directive` configuration applies to components as well{@endtarget}
{@target ts}`@Component` extends `@Directive`,
so the `@Directive` configuration applies to components as well{@endtarget}
2015-11-05 10:04:55 -05:00
@cheatsheetItem
syntax:
`moduleId: module.id`|`moduleId:`
description:
If set, the `templateUrl` and `styleUrl` are resolved relative to the component.
2015-11-05 10:04:55 -05:00
@cheatsheetItem
syntax(ts):
`viewProviders: [MyService, { provide: ... }]`|`viewProviders:`
syntax(js):
`viewProviders: [MyService, { provide: ... }]`|`viewProviders:`
description:
List of dependency injection providers scoped to this component's view.
2015-11-05 10:04:55 -05:00
@cheatsheetItem
syntax:
2015-11-06 07:26:24 -05:00
`template: 'Hello {{name}}'
templateUrl: 'my-component.html'`|`template:`|`templateUrl:`
description:
Inline template or external template URL of the component's view.
2015-11-05 10:04:55 -05:00
@cheatsheetItem
syntax:
2015-11-06 07:26:24 -05:00
`styles: ['.primary {color: red}']
styleUrls: ['my-component.css']`|`styles:`|`styleUrls:`
description:
List of inline CSS styles or external stylesheet URLs for styling the components view.