Fireship · @fireship
Angular in 100 Seconds
Uploaded September 9, 2020 · Length 2:00
Summary
angular tutorial for beginners: cli, components, dependency injection, and more
- angular
- typescript
- ui framework
- component-based
- dependency injection
Transcript preview
The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.
- 0:00
angular a typescript-based framework for
- 0:02
building user interfaces
- 0:04
it was developed at google and released
- 0:05
in 2016 as the sequel to angularjs
- 0:08
as an angular developer you hit the
- 0:10
ground running with its extremely
- 0:11
powerful cli tool
- 0:13
when you generate your initial
- 0:14
application it comes pre-configured with
- 0:16
routing
- 0:16
a testing framework and your favorite
- 0:18
style preprocessor in addition
- 0:20
the magic ng add command can turn your
- 0:22
app into a progressive web app
- 0:23
add server-side rendering firebase
- 0:25
support and do a whole bunch of other
- 0:27
cool stuff
- 0:28
but at its core angular is just a
- 0:30
component-based ui library i can create
- 0:32
a component with the cli
- 0:33
and if we go into its typescript file
- 0:35
you'll notice the component decorator
- 0:36
which makes this typescript class a
- 0:38
component any properties on this class
- 0:40
are considered reactive state
- 0:41
and when their values change the
- 0:43
component will re-render the ui
- 0:44
for example we can bind the property to
- 0:47
html using double braces in the template
- 0:49
from there we can add a button that
- 0:51
increments this value every time it's
- 0:53
clicked
- 0:53
we add the event name on the left side
- 0:55
in parentheses then an expression
- 0:57
on the right side in this case it points
- 0:58
to a method in our class
- 1:00
each time the button is clicked it calls
- 1:01
the method which changes the state
- 1:03
and re-renders the ui angular also has a
- 1:06
variety of directives for building
- 1:07
complex templates
- 1:08
use ngf to handle conditional logic or
- 1:11
if you have an iterable value
- 1:12
use ng4 to loop over it but where
- 1:15
angular really excels is handling
- 1:16
complexity and one of its primary tools
- 1:18
for doing so is called dependency
- 1:20
injection
- 1:21
when your app grows to hundreds of
- 1:22
components you'll likely need a way to
- 1:24
share data and functionality between
- 1:25
them we can take our component logic
- 1:27
here and extract it into a service which
- 1:29
can be treated as a global singleton
- 1:31
throughout the application
- 1:32
now any component that wants to use this
- 1:34
state or logic can simply add this class
- 1:36
to its constructor
- 1:37
the end result is a simple and reliable
- 1:39
way to compose complex applications
- 1:42
as a developer you can always count on a
- 1:44
consistent experience between projects
- 1:46
and minimal decision fatigue this has
- 1:47
been angular in 100 seconds
- 1:49
if you want to see more short videos
- 1:50
like this make sure to like and
- 1:52
subscribe and check out a ton of
- 1:53
advanced angular content on fireship io
- 1:55
thanks for watching
- 1:56
and i will see you in the next one


