Presentación
Vídeo
Transcripción
Extracto de la transcripción automática del vídeo realizada por YouTube.
hello everyone thank you for attending i would like to present our next speaker who is jeff skank who is going to be talking about straightening out angularjs with python a big round of applause please hello thanks all for being here um I'm really excited
to be up here in front of you all I'm going to be walking you through a really basic kind of starter implementation of what you would do to take angularjs and integrate it with a Python back end it's going to be like I said fairly simplistic so if
you've already done angularjs on Python you're probably not going to learn anything and if you're the kind of person who never wants to write a line of JavaScript in your life you're also probably in the wrong place so I i also want to warn
you just briefly i'm not a pro at this my only experience is having done it in production for about a year so we've learned things the hard way and this is kind of what i want to share with you today so 30 seconds on angular and what is this thing
in case you don't know much about it yet so it's a JavaScript MV star framework it's a little bit like any old MVC framework you know except a little different also it's it's basically for you know if you've got a lot of stuff going
on in the front end of your application you don't want to hook it all up with jquery and spaghetti code dealing with all that angular or really any of the other front-end frameworks ember and backbone are going to be your best friend there I like angular
it's interesting it actually as far according to google trends which as we all know is a very reliable source of data overtook backbone quite some time ago a year and a half ago I believe which was surprising to me because I had always heard of backbone
as kind of the granddaddy of them all so anyway what is angular its claim to fame what makes it really special i think is it extends the HTML vocabulary so what that means is you know you're writing HTML but you get all of these extra things that you can
play with and declarative lee write a bunch of HTML stuff that angular then turns into this beautiful functioning app through the magic of two-way data-binding so you know you change the value over here and it automatically updates your HTML to match this
is all really cool really fun to see really good to play with but we're not going to do that here because this is PyCon and if you want to go to javascript con or whatever they call their thing you can do that on your own time like I said it's getting
kind of popular and I do highly recommend it there's still some rough edges it's still a fairly young framework but it's it's really good at what it does and then you know fair's fair so if you've never heard of Python before it's
pretty great it also has a number of MVC ish or mb star frameworks and at least one of them is actually pretty good i'm not here to start any fights but at work we use django and so a lot of the examples i'm going to use are all from Django but the
concept should be fairly easily translated and if you want to yell at me about pyramid and flask at the end you're welcome to do that yeah so the point is all of these things are kind of MV star frameworks angularjs on the front end and then Django or
pyramid or flask or whatever you're doing on the back end so step by step what are we going to do first off we need to have our Python back end serve up angular now for starters that's just a base HTML page no big deal it's normal HTML like before
javascript even existed and usually you'll serve this on on the the root URL depending on how you want to set it up but if the angular is going to be your kind of end-all be-all application you're actually going to want to set it up so that all of
the URLs all serve angular and then angular handles all of your routing so what does that look like this is a very basic angular app about as basic as you could possibly make one and I'm going to do a little bit of hand waving around the angular again
this is PyCon not not Jas whatever so there is some cool stuff to be done to be talked about in the angular world and we're not going to touch on that but happy to talk about it afterward if you want to pull me aside so what are we doing here first off
we're loading up angular right so we've got that angular library there and then your application code which again we're not really going to go into you've got to tell angular where your app is with this ng-app command instantiate a controller
and then here's the magic that we talked about with the two-way data-binding so you can see this looks more or less just like regular HTML but it's got some special attributes and some weird curly braces and stuff so the ng model attribute is what
sets up that two-way data binding and the double curly braces are where you're putting that into your template and so you know the really cool demo that you can go see on angular's homepage is you type into the input and automatically updates in in
[ ... ]
Nota: se han omitido las otras 2.577 palabras de la transcripción completa para cumplir con las normas de «uso razonable» de YouTube.