/
Browse
/
Courses
/
Routing in Spartacus
/
Course Assignment
Course
System information
Introduction to Routing
Installation
Enabling Context in the Storefront URL
Adding Content Pages
Customizing Routes
Using Router Links
Hands-On Exercises
Sample Solution for the Exercises
Downloads
Quiz
Course
System information
Introduction to Routing
Installation
Enabling Context in the Storefront URL
Adding Content Pages
Customizing Routes
Using Router Links
Hands-On Exercises
Sample Solution for the Exercises
Downloads
Quiz
Knowledge quiz
It's time to put what you've learned to the test, get 8 right to pass this week.
1.
How do you make a product name in the URL lowercase?
Choose the correct answer.
Create a product normalizer, which lowercases the name, and provide it.
Use lowercase pipe after the cxUrl pipe.
Modify the back end so that all product names are lowercase.
You cannot make a product name in the URL lowercase.
2.
Which of the following statements about routing in Spartacus are true?
There are two correct answers.
After adding a page in the CMS you have to add a route to it in Spartacus.
Default routing configuration can be found in the default-routing-config.ts file.
You can add multiple aliases for a route in Spartacus.
Only one path can exist for a single route.
3.
Which parameter must appear in the product details route?
Choose the correct answer.
productName
productCode
productId
productSKU
4.
Which of the following examples is the correct way to create a link to a product details page?
Choose the correct answer.
<a [routerLink]="{cxRoute: 'category', params: {code: '574'}} | cxUrl">Product</a>
<a [routerLink]="{cxRoute: 'product', params: {code: '300938'}} | cxUrl">Something</a>
<a [routerLink]="['p', '300938']">Prod</a>
<a href=”product/300938”>Product</a>
5.
What is the name of the pipe to transform a named route into a routerLink?
Choose the correct answer.
cxPipe
cxUrl
cxTransformUrl
cxRoute
6.
Which of the following configurations is valid?
Choose the correct answer.
ConfigModule.withConfig({ routing: { routes: { product: { paramsMapping: { uglyName: 'name' }, paths: ['prod/:productCode/cool/:uglyName', 'p/:productCode/:uglyName', 'prod/:productCode'] }, } } }),
ConfigModule.withConfig({ routing: { routes: { product: { paramsMapping: { pCode: 'code' }, paths: ['products/:pCode'] }, } } }),
ConfigModule.withConfig({ routing: { routes: { product: { paths: ['products/:name'] }, } } }),
ConfigModule.withConfig({ routing: { routes: { product: { paths: ['products/:name', 'products/:code'] }, } } }),
7.
Which of the following routes could be valid in relation to the following configuration? product: { paths: [ 'products/electronics/:category/:productCode/:name', 'prod/ele/:productCode/:name', 'prod/ele/:productCode', 'products/:category/:manufacturer/:productCode/:name' ] },
There are two correct answers.
http://localhost:4200/electronics-spa/en/USD/products/Digital-Compacts/HP/300938/Photosmart%20E317%20Digital%20Camera
http://localhost:4200/electronics-spa/en/USD/products/electronics/Digital-Compacts/358639/DSC-N1
http://localhost:4200/electronics-spa/en/USD/products/electronics/p/358639
http://localhost:4200/electronics-spa/en/USD/products/electronics/Digital-Compacts/300938
8.
Which of the following is an example of a stateful URL?
Choose the correct answer.
http://localhost:4200/Open-Catalogue/Cameras/Digital-Cameras/c/575
https://localhost:4200/Open-Catalogue/Cameras/Digital-Cameras/c/575
http://localhost:4200/en/Open-Catalogue/Cameras/Digital-Cameras/c/575
http://localhost:4200/electronics-spa/en/USD/Open-Catalogue/Cameras/Digital-Cameras/c/575
9.
What is a stateful URL?
Choose the correct answer.
A URL pointing to the state page
A URL that contains parameters that enable it to be shared
A bad practice
A URL that contains information about language
10.
Why is configurable routing important?
There are two correct answers.
It helps search engine optimization.
It makes Spartacus faster.
It makes Spartacus PWA-ready.
It allows links to be made shareable.