SymfonyCon Madrid 2014

Introducción a AngularJS

Alessandro Nadalin  · 


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

okay welcome everyone thank you for coming here should I still don't know what am i doing at a beach big conference but that's all good so I want to reduce myself at the end of the talk I think there is a lot of stuff to look at and so i'll just

keep the introduction my introduction for last and i'm going to give you an overview of actually like what we're going to see in this talk first of all like we're gonna dig a little bit in like how angular words why we picked it i work for an amp

she an e-commerce retailer the biggest e-commerce retailer i guess in the Middle East were based in Dubai and we use the angular in a few different parts of our architecture so to give you a perspective of where we actually employ angular well in a lot of

small internal tools ok so those are not really mission-critical so it's nice to experiment with them we also use it and abuse it on our mobile applications now I'm not at mobile apps but on our mobile website and our mobile checkout which is probably

the most critical part you know in any commerce ecosystem and also now we're desktop checkout which is of course ugly is l cuz we're in e-commerce venture so we're at leas amazon at least so we UB is angular also like on the checkout we have a

service-oriented architecture so you might be wondering why do you have all these applications well because we use micro services so you know there is one application that takes care of you know like that's the website one application that takes care of

the mobile website one takes care of mobile check on one blah blah blah blah blah and so on and so forth why we picked it it was very it was very quite of a natural choice when we actually dug into you know how to scale into the client side we have background

of you know like PHP engineering I've been doing that for the past six years for six years and then like since the past year I move myself to JavaScript so one of the killer feature is two-way data-binding who of you know knows is two-way data-binding

a few okay so I won't like go like too deep into it and basically the model changes the view okay and the view changes the model what the heck I have that possible in the sense that we are used to you know like pretty sequential applications in a world

of PHP they're generated server side and once you do something to the view it's not that it's going to change you know it's going to change the model back your girls you're going to send your response to the client and that like they're

the life cycle of the above the request and with the response sent to the two browsers so I prepared a small fiddle to show you what actually like two-way data binding is so this is a controller in angular you can use like a very simple function and getting

like the scope injected scope is let's say what is shared between a controller and the views okay so we have we attached like a variable on the scope and then like on our views my first declare our our app we declare that it's going to use the controller

that we've just defined in JavaScript and then you remember we have scoped the title then we'll say there are two input fields and they're bound their model is the title field okay so basically that scope do title we reference the title and the

view thing is the view will reference the the object in the controller as well so if you've seen I have to input boxes right which means that when i run this this simple script as soon as i'm diving in one box the other one will get updated okay because

like the view will update the model and the model is bound to another view okay to another input on the view it's very simple it's a very simple and linear approach you can actually check like the official docs understand like in-depth like our data

binding works basically angular watches for values and so on there is also a new API that is coming in I think it's like my script 6 which is called object o sir observe which will do this natively for now like the way angular does it just watches values

and then propagates the changes are the best injection like we're all sinfonia year so I mean most probably dependency injection has been one of the revolutions that we that we got going from Symphony 12 symfony2 if any one of you was there like back at

the time so we have our own like you know plain old controller it's basically a function I get the scope injected somehow and I also get the location service injected okay so this is the way angular does dependency injection okay so that you can use okay

your services like freely without any debt to actually configure anything at least for the native services and it's actually a little bit out of magical okay so if you remember in 2012 when one for being introduced symfony2 it was like let's kill the

magic angular goes a little bit against this direction and at least for these things you know it makes you like do like very less configuration and rely much more on conversion convention so you declare a service and then you just you can just use it and it

does its own voodoo of dependency injection like natively like with within the framework so this is like a very it's a very simple it's again a very simple script that you can just the check and run and it will show you like a dependency injection

work the support I mean one of the most important things I think like when you pick a when you pick a tool like symphony or like angular it's you know like the community and who was behind and around that thing's Symphony is rocking the PHP echo system

because it has a huge community you like very good foundation it's nine years old and you know like you can rely on like a broader list of you know like people and smart minds there are behind it angular has the same but at the same time you know it does

also has that's Google supports it you know basically support Google adopted it from one of its employees myshko Avery who wrote it for one of this personal project and then was like I think this thing makes sense so let's let's present it to my

boss then like Google incubated it and now they're actively developing it so when we look at you know like how the market is doing for for angular we saw a huge spike and that was almost a year ago and we're like okay so probably it's time you

know to dig into it but we weren't like you know it's like very silly like a silly to do you know like to say okay let's just pick it because it has a huge huge boost in in usage over the past month we've also compared it to you know to other

frameworks and we've seen that you know like the rise of other tools was pretty insignificant to it angular was so so popular and by the time that I looked at it it actually matched apple pies okay and I really have no idea why I think as apple pies I

have a very down period in summer I guess I picks up back in October and you know there are a lot of other tools that are built around angular for example protractor is the testing framework that is used specifically for angular you can use a lot of other

[ ... ]

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