Fireship · @fireship
Angular CDK Data Tables
Uploaded July 19, 2018 · Length 10:38
Summary
Building a custom data table with Angular CDK and Bootstrap 4, including reactive behavior and styling.
- angular cdk data table
- custom data table
- reactive table
- angular bootstrap 4
- cdk table styling
Transcript preview
The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.
- 0:00
[Music]
- 0:06
what if there is a way that you could
- 0:08
capture all the benefits of annular
- 0:09
material but customize the behavior and
- 0:11
styling in an unaffiliated way well
- 0:14
that's exactly what angular's component
- 0:16
development kit does in today's video
- 0:18
you'll learn how to build a reactive cdk
- 0:20
data table that implements its own
- 0:21
custom behaviors and also uses bootstrap
- 0:24
4 for its CSS styling if you're new to
- 0:27
the channel make sure to LIKE and
- 0:28
subscribe and the code for this video is
- 0:30
produced by Zack DeRose who is a senior
- 0:32
team lead working on angular over at
- 0:34
Swamp Fox Inc
- 0:36
make sure to check out his full article
- 0:37
on medium because it goes into some
- 0:39
advanced stuff that I don't cover here
- 0:40
such as searching sorting and applying
- 0:42
styles on a cell-by-cell basis I'm
- 0:45
starting out from the state regular
- 0:47
angular 6 app and the first thing I'll
- 0:49
do is install the component development
- 0:50
kit which is at angular slash cdk then
- 0:54
I'll generate a component called table
- 0:56
from there I'll jump over to the app
- 0:58
module and we'll want to import the data
- 1:01
table from angular cdk then add the cdk
- 1:05
table module to the imports array the
- 1:07
first table we'll build is pretty basic
- 1:09
and ugly but what it's doing under the
- 1:11
hood is pretty powerful
- 1:12
and without the cdk this would take a
- 1:14
lot more code than it does in this video
- 1:16
I'll be working with some dummy data
- 1:18
throughout this video which I have saved
- 1:20
in this data Ts file first we have an
- 1:23
array of column names which just define
- 1:25
the names of the columns in the table
- 1:27
and then we have the actual data which
- 1:29
is a map of various heroes and each hero
- 1:33
has a set of properties that match these
- 1:35
column names so basically this simulates
- 1:37
some initial data that you might pull
- 1:39
from a back-end database or API now
- 1:42
let's jump into the component and start
- 1:44
putting together this table I'm going to
- 1:47
go pretty slow through this code because
- 1:48
I want to talk about behavior subjects
- 1:50
and observables because they're very
- 1:52
powerful structures when working with
- 1:54
tables a behavior subject is really
- 1:56
useful when you have a value that you
- 1:58
want to manually change over time they


