Fireship · @fireship

Advanced Angular Elements

Uploaded December 6, 2018 · Length 11:46

Advanced Angular Elements

Summary

advanced angular elements techniques for building web applications with web components, lazy loading images, and optimizing performance with angular and firebase.

  • angular elements
  • web components
  • lazy loading
  • performance optimization
  • angular and firebase
  • custom elements
  • shadow dom
  • change detection
  • web development

Transcript preview

The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.

  1. 0:00

    [Music]

  2. 0:06

    one of the most exciting trends

  3. 0:08

    happening in web development is the

  4. 0:09

    adoption of web components because they

  5. 0:11

    allow us to build applications that

  6. 0:13

    don't walk us in to a specific framework

  7. 0:14

    or a programming style I'm going to be

  8. 0:16

    using web components in production very

  9. 0:18

    soon so I wanted to share some advanced

  10. 0:19

    concepts that I've learned working with

  11. 0:21

    angular elements and I'll even show you

  12. 0:23

    how to achieve a near perfect white

  13. 0:24

    house performance score with the full

  14. 0:25

    power of angular and firebase in your

  15. 0:27

    Java Script bundle if you're new here

  16. 0:29

    like and subscribe and congrats to

  17. 0:31

    Damian right who's last week's t-shirt

  18. 0:32

    winner but don't worry if you missed out

  19. 0:34

    there's another one of a kind t-shirt

  20. 0:35

    going out this week all you have to do

  21. 0:36

    is leave a comment below over the last

  22. 0:39

    few months I've been building a product

  23. 0:40

    called fire ship IO which is just a

  24. 0:42

    better way for me to deliver my content

  25. 0:44

    to you this project needs to be very

  26. 0:46

    fast in search engine optimized but it

  27. 0:48

    also needs to use firebase for user

  28. 0:49

    authentication and dynamic data the

  29. 0:52

    beauty of web components is that I can

  30. 0:53

    pre render all of my static content and

  31. 0:55

    then bootstrap in custom elements when

  32. 0:57

    they're needed throughout this journey

  33. 0:58

    I've used pretty much every web

  34. 1:00

    component tool that's out there and I

  35. 1:01

    found that angular elements is the most

  36. 1:03

    productive for a larger project but

  37. 1:05

    you'll also want to check out stencil

  38. 1:06

    and lit element which I think are both

  39. 1:07

    very promising

  40. 1:08

    the big advantage of elements is that a

  41. 1:10

    you get the full power of angular and B

  42. 1:12

    your components can share the same

  43. 1:13

    dependency injector tree which means you

  44. 1:15

    can easily share data or functionality

  45. 1:17

    between your custom elements and see the

  46. 1:19

    API is stable and being used in

  47. 1:20

    production at Google today we're going

  48. 1:22

    to build a custom element that can lazy

  49. 1:24

    load an image based on the user scroll

  50. 1:26

    position in the browser when the image

  51. 1:28

    is loading it will show this Facebook

  52. 1:30

    style shimmer placeholder then replace

  53. 1:32

    it with the image when it's fully loaded

  54. 1:33

    now we'll jump into some code but if you

  55. 1:35

    haven't already seen my original angular

  56. 1:36

    elements video you'll want to check that

  57. 1:37

    one out which is a little more basic

  58. 1:39

    level the first thing I want to do is go

  59. 1:41

    into your angular app and then run ng

  60. 1:43

    add at angular elements this will

  61. 1:45

    install the dependencies and also add

  62. 1:47

    the polyfills to ensure that your

  63. 1:48

    elements are compatible with all

  64. 1:50

    browsers then you can go into the app

  65. 1:52

    directory and you'll want to just go

  66. 1:53

    ahead and delete everything except for

  67. 1:55

    the app module you'll also notice I've

  68. 1:57

    generated a couple of regular components

  69. 1:59

    in here as well the first thing I want