Angular 2 Fundamentals 25 [w/ subs]



00:00:01 – okay so we've looked at interpolation
00:00:03 – property bindings and expressions now
00:00:07 – let's take a look at event bindings and
00:00:09 – statements this event binding is binding
00:00:12 – the buttons click event to the do
00:00:14 – something function on our profile
00:00:15 – component so that will be called when
00:00:18 – this button is clicked notice that event
00:00:20 – bindings use parentheses around the
00:00:22 – element event to bind to versus property
00:00:25 – bindings that use square brackets and
00:00:26 – notice the statements follow an event
00:00:29 – binding and are put in quotes let's take
00:00:32 – a look at the guidelines for template
00:00:33 – statements template statements have
00:00:36 – similar restrictions to template
00:00:38 – expressions with a couple of exceptions
00:00:39 – statements actually do allow you to make
00:00:42 – assignments using equals but assignment
00:00:45 – operators other than equals are still
00:00:47 – prohibited and then you actually are
00:00:48 – allowed to change expression statements
00:00:50 – but these other restrictions still
00:00:52 – remain for statements and as far as
00:00:55 – recommendations for statements they
00:00:57 – actually can have side effects
00:00:59 – in fact they often do it's pretty much
00:01:01 – the norm for statements to make changes
00:01:03 – to the state of the application so
00:01:05 – therefore they are also not required to
00:01:07 – be item potent and while you never want
00:01:10 – any part of your application to actually
00:01:11 – be slow statements typically will end up
00:01:14 – calling a function or something that
00:01:17 – makes an AJAX call or something that's
00:01:18 – slower so there isn't quite the same
00:01:20 – requirement for them to be fast so the
00:01:23 – only real recommendation for statements
00:01:26 – is that they should still be simple
00:01:27 – again you shouldn't be doing a lot of
00:01:30 – business logic in your templates they
00:01:32 – can however call a function on the
00:01:34 – component that is more complex so really
00:01:36 – this is the only recommendation that
00:01:38 – remains for statements


Video Url:
http://youtu.be/zockwpXxLpA

Comments

comments