I am little bit confused by angular official doc. I was trying to learn how to use Angular universal to build something. But I saw this command in the doc:
ng add @nguniversal/express-engine
which is quoted from https://angular.io/guide/universal.
But AFAIK there is another command called "ng generate universal".
To my guess.., ng generate universal is part of ng add @nguniversal/express-engine(am I right?), So what is the main difference between those two commands?
ng add is a schematic that first installs the @nguniversal/express-engine here. That will provide your local ng CLI with some extra commands - one of which is ng generate universal. It will do so by installing the npm package (and potentially adjusting some of your local files).
ng universal is another schematic, which will (with the help of the newly installed package from the previous step) create the universal app.
Think about what happens when you, e.g. ng add @angular/material.
That installs the @angular/material package (and updates your project files by modifying package.json and maybe other stuff).
With those installed, you can now generate material components, e.g. table or a dashboard.
It's the same here. They're different schematics - at a very abstract level, they do the same thing - modify files in your project directory), but specifically "add" has a different job then "generate".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With