Coder Social home page Coder Social logo

movies's Introduction

This is a walktrough for the course.

You can view the presentation here

Create project

  • npm i -g @angular/cli@14
  • ng new movies
  • install angular language service plugin
  • ng serve
  • App structuur bekijken
    • Package.json
    • Index.html
    • Main.js
  • ng add @ng-bootstrap/[email protected]

Add header

  • Alles verwijderen uit app.component.
  • header component aanmaken en zorg ervoor dat de titel van uit het app component wordt doorgegeven
    • kan met input of content projection
    • show encapsulation in devtools (emulated vs shadowdom)

Add in mem movie service en model

  • setup mock api
    • npm install angular-in-memory-web-api --save-dev
    • Create database folder onder app en add in-memory-movie.service.ts, movie.model.ts en movies.data.ts (doorsturen)
    • add to HttpClientInMemoryWebApiModule.forRoot(InMemoryMovieService) to app.module imports

Show all movies on home page

  • show pipes and directives part in ppt
  • add movies as a prop on app.component
  • create movie overview component
  • create movie component -movie title uppercase pipe
  • use *ngFor

Highlight todo item on hover

  • use custom directive with mouseEnter/mouseLeave
  • 2 options => change style on hover or add class on hover

add movie form component

  • show forms part in ppt
  • create a movie-form component
  • create a form with formgroup for fields: title, year and isFavorite
  • add required validators on title and and year
  • add output for submit action
  • handle form output in app component by pushing movie to array

angular devtools

  • explain cd (every change inputs, events, settimeout/interva etc, whole component tree etc)
  • open angular devtools (https://chrome.google.com/webstore/detail/angular-devtools/ienfalfjdbdpebioblfackkekamfmbnh)
    • show component tree
    • enable profiler and change year value => all components in CD
  • explain onpush (input by reference, only impacted components in cdref tree)
  • enable onpush everywhere and show differences in angular devtools
  • default VS onpush in stackblitz examples (record with angular devtools profiler => click the add or click me button a coouple times => compare CD with flame grapgh)

move form to other route

  • show router part of ppt
  • add empty path to to router with redirect to 'movies path
  • add movies path to to router with component app movie overview
  • add movies/edit path to to router with form component as component
  • replace 'app-movie-overview' tag with 'router-outlet' tag in app component
  • move movies property to movie-overview component
  • add 'add' link in header with routerlink

Add movie service

  • show httpclient in ppt
  • create movie.service onder services folder manueel
    • inject HttpClient (module should be added)
    • add endpoint 'api/movies' to environment
    • add function to get all
    • add catchError and demonstrate with wrong api url
    • use getMovies in movie overview component with async pipe
    • add addMovie in form component with subscribe and router navigate to ho

Navigate to form edit component

  • add edit/:id path to to router with component form
  • get todoById oninit with snapshot id
  • keep movie object as local prop
  • patch form
  • update or add ;

DIY

  • destroy subscriptions to prevent memory leaks
  • add movie-data service which handles all data
  • add overview template (contentchildren with count)
  • add custom year validator
  • control value accessor
  • implement ngrx
  • async validator
  • edit view lazy loaded
  • edit view in sidepanel

movies's People

Contributors

jenscocquyt avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.