Angular › Angular CLI & Project Structure
How would you generate a new component, service, or module using Angular CLI commands?
IntermediateAnswer
The CLI provides generate commands, often shortened to g, that create new files following Angular's recommended structure and naming conventions automatically, saving you from manually creating and wiring up each file by hand.
ng generate component user-profile
// shorthand version
ng g c user-profile
ng generate service auth
ng g s authReal-world example A developer adding a new feature generates a component and its matching service using two quick CLI commands, instantly getting properly named and structured files instead of manually creating them from scratch.