From the course: Creating Angular Libraries

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

Angular schematics factory functions

Angular schematics factory functions - Angular Tutorial

From the course: Creating Angular Libraries

Angular schematics factory functions

- [Instructor] Every schematic has four ingredients, a tree, a rule, an action, and a context. We briefly looked at each of these ingredients earlier in this course. For this video, we'll focus on actions. I opened our project here in a GitHub Codespace. I talk about why we use Codespaces earlier in this course, so for now, just think of them as an easy way to share and write code without installing anything on your local machine. From the root of our workspace, I'll go to projects, ngx-gem-finder, schematics, ng-add, and click on index.ts to open the file. Actions are functions that return something called a rule. Angular sometimes calls these functions rule factories. Rules are just functions that take in a set of files, applies one or more transformations, and returns a new set of files. You can call these factory functions, whatever you'd like, but they're usually named the same name as the command used to invoke them. This schematic is for the ng-add command, so that's what I…

Contents