Schematics is a workflow tool for the modern web; it can apply transforms to your project, such as create a new component, or updating your code to fix breaking changes in a dependency. Or maybe you want to add a new configuration option or framework to an existing project. Angular schematics are part of angular-cli and are used to generate components, modules, pipes, etc.
Questions tagged [angular-schematics]
179 questions
5
votes
4 answers
Angular Schematics Prompt for array type
When setting up my schematics I see that I can prompt for any of the following types String | Boolean | Array | Number | Integer | Null | Object.
I am trying to set up a schematic that prompts the user to select a module from a list of available…

efarley
- 8,371
- 12
- 42
- 65
5
votes
2 answers
Schematic "my-comp" cannot resolve the factory
I'm following this book: https://github.com/manfredsteyer/schematics-sample
When I execute my schematics
schematics .:my-comp
I get the following error:
An error occured:
Error: Schematic "my-comp" cannot resolve the factory.
at…

Jorge C
- 63
- 7
5
votes
2 answers
Angular 7 - Add custom babel plugin to build chain
I want to add the optional-chaining babel plugin to my Angular 7 build but can't find any documentation on if it's possible to add a .babelrc or schematic to my current project to amend/add custom plugins.

halfmatthalfcat
- 177
- 3
- 12
5
votes
2 answers
Angular 6 Schematics Invalid Source (undefined)
I'm creating some custom schematics that will help us spin up angular library projects quickly. Given that, I don't want developers to have to have a checklist of ng ... commands they have to run to get a library up and running, I'd like to just…

Matt
- 823
- 1
- 8
- 17
5
votes
1 answer
What does branchAndMerge function in Angular schematics do?
I'm experimenting with Angular schematics, and have encountered the function branchAndMerge() in various places. No one explains what it does, however.
Places I have seen it:
Generating Custom Code With The Angular CLI And…

MartinJH
- 2,590
- 5
- 36
- 49
4
votes
1 answer
How to run e2e Angular tests with Playwright?
I would like run end-to-end (e2e) browser tests for my Angular application using Playwright. However, as of November 2021, I have not been able to find an Angular Schematic for Playwright.
For example, there is an official Angular Schematic for…

Christopher Peisert
- 21,862
- 3
- 86
- 117
4
votes
1 answer
Extending NX generate component
In my Monorepo, there are two types of components that i am using.
Is a standard component for applications, and nx g c foo works fine here.
Is a library component for a library. Here, I exclusively use secondary entry points. So a component always…

Harrys Kavan
- 741
- 9
- 28
4
votes
1 answer
Extending Angular Schematics
What is the best way to extend an existing Angular Schematic? I'm looking specifically at adding some default code into a component's spec file at the moment, but a more generalized answer would be appreciated.
In the tutorials I've found, they show…

Logan Waite
- 423
- 5
- 12
4
votes
1 answer
Material Dashboard not showing up inside the Navigation Schematic when using routerLink in Angular 7
Hi I am trying to add a Navigation Schematic in my project in which the first link will show the dashboard, so when the page is displayed first it should show the dashboard. Later I will add additional links.
The issue is when I try to add the…

Nil.G
- 45
- 4
4
votes
5 answers
Angular Schematics: How to define default variables in schema.json? (projectName)
How to define default variables for angular schematics "properties" in schema.json?
I have tried to look into the angular source code itself but I couldn't figure it out. I have found out that if the keyword "$source" is being used, somehow the…

Ali Niaki
- 128
- 2
- 11
4
votes
1 answer
ClassOptions Schema - Angular Schematics
In the @angular-devkit/schematics readme, I am confused on what the ClassOptions is doing.
If you add the code to a project, it will show an error because this file does not exist.
Thoughts on what this is used for + an example?
import { strings }…

Tony Scialo
- 5,457
- 11
- 35
- 52
4
votes
0 answers
ng update not running migration.json schematic
Versions
node --version
v8.11.3
npm --version
6.4.1
ng --version
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
…

Tanzeel
- 455
- 6
- 16
4
votes
2 answers
Custom project-level templates for angular components generated via angular-cli
How do I add custom angular component schematics to existing project?
I would like to have e.g. my-page component templates that will replicate existing \node_modules\@schematics\angular\component\ files but with edited templates.
I expect it to be…

godblessstrawberry
- 4,556
- 2
- 40
- 58
4
votes
1 answer
How configure inline style and html template in `angular.json`?
It look like all tutorials show how config it in the old angular.cli.json format.
"defaults": {
"styleExt": "css",
"component": {
"inlineStyle":true,
"inlineTemplate":true
}
}
but not in the angular.json format.
and that arises the…

pery mimon
- 7,713
- 6
- 52
- 57
4
votes
1 answer
Angular Schematics. Customizing the angular.json file
When I build my site with schematics (ng new --collection=@foo/schematics myproject), everything works fine, except one thing:
The resulting angular.json file only includes a single style file in the styles array, I need it to include multiple…

Scott B
- 38,833
- 65
- 160
- 266