What command do you use to create a new Angular project?
You use ng new project-name to create a new Angular project with the Angular CLI.
Click to reveal answer
beginner
What does the Angular CLI do when you run ng new?
It creates a new folder with the project name, sets up the basic files and folders, installs dependencies, and configures Angular settings.
Click to reveal answer
beginner
Why is it important to have Node.js installed before creating an Angular project?
Because Angular CLI uses Node.js to run commands and manage packages needed for the project.
Click to reveal answer
intermediate
What is the purpose of the --routing option when creating a new Angular project?
It adds routing support to your project, creating files to help manage navigation between pages.
Click to reveal answer
beginner
How do you start the Angular development server after creating a project?
Run ng serve inside the project folder to start the server and see your app in the browser.
Click to reveal answer
Which command creates a new Angular project named 'my-app'?
Ang new my-app
Bng create my-app
Cangular new my-app
Dnpm init my-app
✗ Incorrect
The correct command is ng new my-app to create a new Angular project.
What must be installed before using Angular CLI to create a project?
AJava
BPython
CNode.js
DRuby
✗ Incorrect
Node.js is required because Angular CLI runs on Node and manages packages.
What does the --routing flag do when creating a new Angular project?
AAdds routing support
BEnables server-side rendering
CInstalls extra UI libraries
DCreates a backend API
✗ Incorrect
The --routing flag adds routing files to manage page navigation.
After creating a new Angular project, which command starts the development server?
Anpm start
Bng serve
Cng start
Dnode server.js
✗ Incorrect
Use ng serve to start the Angular development server.
What folder structure does Angular CLI create by default?
Alib, bin, config
Bapp, public, views
Cassets, components, services
Dsrc, e2e, node_modules
✗ Incorrect
Angular CLI creates src for source code, e2e for tests, and node_modules for packages.
Explain the steps to create a new Angular project from scratch.
Think about what tools you need and the commands you run.
You got /6 concepts.
Describe what happens behind the scenes when you run ng new.
Consider file creation and package installation.
You got /5 concepts.
Practice
(1/5)
1. What command do you use to create a new Angular project named my-app with default settings?
easy
A. ng generate project my-app
B. ng create my-app
C. angular new my-app
D. ng new my-app
Solution
Step 1: Understand Angular CLI command for new projects
The Angular CLI uses ng new followed by the project name to create a new project.
Step 2: Identify the correct syntax
The correct command is ng new my-app. Other options are invalid CLI commands.
Final Answer:
ng new my-app -> Option D
Quick Check:
Angular CLI new project = ng new [OK]
Hint: Use 'ng new' plus project name to create Angular app [OK]
Common Mistakes:
Using 'ng create' instead of 'ng new'
Typing 'angular new' which is not a CLI command
Using 'ng generate project' which is invalid
2. Which of the following commands correctly creates a new Angular project with routing enabled and SCSS as the style format?
easy
A. ng new my-app --routing --style=scss
B. ng new my-app -routing -style=scss
C. ng new my-app --routing scss
D. ng new my-app --route --style=scss
Solution
Step 1: Recall Angular CLI options for routing and style
The correct flags are --routing to enable routing and --style=scss to set SCSS styles.
Step 2: Check syntax correctness
ng new my-app --routing --style=scss uses correct double dashes and equals sign. Other options have wrong flags or missing dashes.
Final Answer:
ng new my-app --routing --style=scss -> Option A
Quick Check:
Enable routing and SCSS with --routing and --style=scss [OK]
Hint: Use double dashes and equals for options in ng new [OK]
Common Mistakes:
Using single dash for long options
Writing '--route' instead of '--routing'
Omitting equals sign for style option
3. After running ng new test-app --routing --style=css and then cd test-app followed by ng serve, what will happen?
medium
A. The app will fail to compile due to missing routing module
B. The Angular app will compile and be available at http://localhost:4200
C. The app will compile but show a blank page because CSS is not supported
D. The command will throw an error because 'ng serve' must be run before 'cd test-app'
Solution
Step 1: Understand Angular CLI workflow
Creating a project with routing and CSS style is valid. Changing directory into the project folder is required before serving.
Step 2: What ng serve does
ng serve compiles and launches a local server at port 4200 by default, showing the app in the browser.
Final Answer:
The Angular app will compile and be available at http://localhost:4200 -> Option B
Quick Check:
ng serve runs app at localhost:4200 [OK]
Hint: Run ng serve inside project folder to view app in browser [OK]
Common Mistakes:
Running ng serve outside project folder
Assuming CSS is unsupported
Expecting errors from valid routing option
4. You run ng new my-app --routing --style=less but get an error saying the style option is invalid. What is the likely cause?
medium
A. LESS is not supported by Angular CLI by default without extra setup
B. The --routing flag must come after --style option
C. You must use --styles instead of --style
D. The project name 'my-app' is invalid
Solution
Step 1: Check Angular CLI supported style formats
Angular CLI supports CSS, SCSS, Sass, and Stylus by default. LESS requires extra setup or dependencies.
Step 2: Analyze error cause
The error about invalid style option likely means LESS is not recognized without additional configuration.
Final Answer:
LESS is not supported by Angular CLI by default without extra setup -> Option A
Quick Check:
LESS needs extra setup, not default [OK]
Hint: Check if style format is supported by default before using [OK]
Common Mistakes:
Thinking option order matters
Using --styles instead of --style
Assuming project name causes style errors
5. You want to create a new Angular project named shop-app with routing enabled, SCSS styles, and skip installing npm packages initially. Which command should you use?
hard
A. ng new shop-app --routing --style=scss --skipNpm
B. ng new shop-app --routing --style=scss --no-install
C. ng new shop-app --routing --style=scss --skip-install
D. ng new shop-app --routing --style=scss --skip-npm
Solution
Step 1: Identify correct flags for skipping npm install
The Angular CLI uses --skip-install to skip installing npm packages after project creation.
Step 2: Confirm routing and style flags
--routing enables routing, and --style=scss sets SCSS styles correctly.
Final Answer:
ng new shop-app --routing --style=scss --skip-install -> Option C
Quick Check:
Use --skip-install to skip npm install [OK]
Hint: Use --skip-install to avoid automatic npm install [OK]
Common Mistakes:
Using incorrect flag names like --no-install
Trying camelCase flags like --skipNpm
Using hyphenated flags not recognized by CLI
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.