ng-conf 2014

AngularJS y RequireJS

Thomas Burleson  · 

Presentación

HTML (pincha para descargar)

Vídeo

Transcripción

Extracto de la transcripción automática del vídeo realizada por YouTube.

hello everyone my name is Thomas burr Wilson on a senior front-end architect at sirius XM radio when Dave called me a few months back and asked me to present at ng-conf I was really excited then he asked me if I would present two topics at ng-conf and I was

even more excited he asked he said how long do you think you need to resent these two talks and I said well for requirejs I need about three hours to present and for the decorator talk I need about an hour and a half he paused now I realize he was laughing

his ass off he responded a little bit later and he said can you do it in 40 minutes and I was a little shocked and I said well I guess I could do it 40 minutes yeah he comes back a little bit later he says I need to do it in 20 minutes I was just shocked I

was waiting for him to come back and say now do it in five and I still would have said yes so let's go and get started that talk that Ben gave on browserify is actually a really interesting perspective on how to handle dependencies and how to wrap your

code to use it not only with an angular but with on other applications this is another perspective on that same sort of approach or set of approaches and issues there's some ideological differences but I think whoops I think it'll be interesting for

us to all to compare the two so let's get started so requirejs the first question always comes to mind is do you need it when you're doing angularjs development and once I we talk about that a little bit then we'll take a fast dive into using requirejs

and then we'll talk about how we're going to use it with angular and in fact sorry I missed something this is probably the number one thing that I want everyone to try to remember the take away from my presentation or these two bullet points angularjs

injects instances requirejs injects classes or references to functions and that's really important because there's a synergy between the two that you can leverage so it's requirejs really needed well one option that we could do with a lot of us

do I've done it many times is we can load all of our code within one JavaScript file here we have a flight dashboard constructor function a queue decorator and then we're registering some other constructor functions as services and then we're registering

our application module and our controller and we're launching that's reasonable for simple applications but look at the code depends the dependencies just for that simple application now let's say I said okay I don't want it all in one javascript

file I want to organize it into packages that's a great approach so now instead now I'm going to manually separate online code into different packages I have a flight dashboard class a queue decorator class of flight service and they're in the

appropriate packages structures but notice I have two on line 8 through 11 I have to manually specify the order I have to remember the dependency order of which file needs to be loaded first and if I ever add any new classes I'm going to have to remember

to come back here and add that in that just doesn't scale what about larger apps so one of the demos I'm going to show in this presentation and I apologize in advance I'm going to be moving very fast but one of the demonstrations of a showing is

the quiz lor app that's all available on github and that application has 24 classes well I certainly don't want to manage those manually and imagine the dependency complexities that you would encounter in your own real-world applications so what we

need is we need a package dependency manager that helps us manage which classes need to be loaded in what order and what are the dependencies of all of those who helps us build out a pendency tree so before we talk talk about how that's working with angularjs

[ ... ]

Nota: se han omitido las otras 1.843 palabras de la transcripción completa para cumplir con las normas de «uso razonable» de YouTube.