nodewithnpminstalled@angular/cliinstalled or runnpm i -g @angular/cli@latestvscode,webstormor other editor installed- feeling adventurous :)
-
We'll be using https://jsonplaceholder.typicode.com/ as a data source
- use
ng generatecommand from@angular/clito generate anything quickly
- create new angular app, for how it's done visit https://cli.angular.io/
- try to experiment with various options of
newcommand - app should be generated and all dependencies installed, if not - switch to folder and run
npm i
-
Overall look and feel:
- there is home page with link to
userspage - page/route structure should look like this:
/users- lists all users available from api/user/:userIdlists user info andalbumsat the top andpostsbelow/user/:userId/albumslists samealbumsasuser/:userIdpage/user/:userId/albums/:albumId/photoslists photos byalbumId
/user/:userId/postslist of posts by that user & contains linkload repliesto load replies by thatpostId- should contain text field and a button to add
postsand/orcomment, handle response and append thatpostand/orcomment
- should contain text field and a button to add
- there is home page with link to
-
Feature usage:
- Must include following:
ngIfto show/hide add comment componentngForwith optimisations (as you load replies there might be performance issues like freezing)componentsthat are reused:albumscomponent on/users/:userIdroute andalbumson/albumsrouteDirectiveto highlight odd/evenpostResolvethat loads data when route is activatedGuardto check whetheralbumorpostbelongs to that userHttpClientto load dataHttpInterceptorto handle404error@Injectableservice to useHttpClientinsideLazymodules for at least one routerouterLinkfor navigationrxjsoperators likefilter,mapetc.FormGroup&FormControlto add commentValidatorsand view validation messages
- Must include following:
-
Well-defined structure:
- each module in separate folder
- each module folder should contain separate folders for
components,services,directives,child modulesif any etc . - there should be separate module for routing, and module that contains all declarations/providers that also imports routing module
- every feature (like
posts,photos,albums) should be contained in separate feature module with it's own routing - every feature module should be lazy-loaded from main
app.module's routing module - components should follow
SOLID-like principle - be as granular as possible