docs(angular): add component examples (#12485)

This commit is contained in:
Colum Ferry 2022-10-10 11:30:18 +02:00 committed by GitHub
parent 65a079cbe1
commit 9460d648ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 45 additions and 1 deletions

View File

@ -359,6 +359,7 @@
} }
}, },
"required": ["name"], "required": ["name"],
"examplesFile": "## Examples\n\n{% tabs %}\n{% tab label=\"Simple Component\" %}\n\nCreate a component named `my-component`:\n\n```bash\nnx g @nrwl/angular:component my-component\n```\n\n{% /tab %}\n\n{% tab label=\"Standalone Component\" %}\n\nCreate a standalone component named `my-component`:\n\n```bash\nnx g @nrwl/angular:component my-component --standalone\n```\n\n{% /tab %}\n\n{% tab label=\"Single File Component\" %}\n\nCreate a component named `my-component` with inline styles and inline template:\n\n```bash\nnx g @nrwl/angular:component my-component --inlineStyle --inlineTemplate\n```\n\n{% /tab %}\n\n{% tab label=\"Component with OnPush Change Detection Strategy\" %}\n\nCreate a component named `my-component` with OnPush Change Detection Strategy:\n\n```bash\nnx g @nrwl/angular:component my-component --changeDetection=OnPush\n```\n\n{% /tab %}\n",
"presets": [] "presets": []
}, },
"aliases": ["c"], "aliases": ["c"],

View File

@ -0,0 +1,42 @@
## Examples
{% tabs %}
{% tab label="Simple Component" %}
Create a component named `my-component`:
```bash
nx g @nrwl/angular:component my-component
```
{% /tab %}
{% tab label="Standalone Component" %}
Create a standalone component named `my-component`:
```bash
nx g @nrwl/angular:component my-component --standalone
```
{% /tab %}
{% tab label="Single File Component" %}
Create a component named `my-component` with inline styles and inline template:
```bash
nx g @nrwl/angular:component my-component --inlineStyle --inlineTemplate
```
{% /tab %}
{% tab label="Component with OnPush Change Detection Strategy" %}
Create a component named `my-component` with OnPush Change Detection Strategy:
```bash
nx g @nrwl/angular:component my-component --changeDetection=OnPush
```
{% /tab %}

View File

@ -110,5 +110,6 @@
"default": false "default": false
} }
}, },
"required": ["name"] "required": ["name"],
"examplesFile": "../../../docs/component-examples.md"
} }