Webbramverk, 1DV450
Linnéuniversitetet, vt 2016
Klientramverk
AngularJS
AngularJS
Denna presentation är licensierat under en
Creative Commons Erkännande 3.0 Unported Licens. (Där inte annat anges)
Baas
"Full-stack" klientramverk
Min erfarenhet av javascriptramverk Varför valde jag angular?
Min erfarenhet av javascriptramverk Varför valde jag angular?
Vem, vad, community, utveckling
Foto cc by: http://www.flickr.com/photos/nyuhuhuu/
Having said, I'd rather see developers build kick-ass apps that are well-designed and follow separation of concerns, than see them waste time arguing about MV* nonsense. And for this reason, I hereby declare AngularJS to be MVW framework - Model-View-Whatever. Where Whatever stands for "whatever works for you"- Igor Minar 19 juli 2012
Foto cc by: http://www.flickr.com/photos/83633410@N07/
Visa hello world Prata om directives Bygg vidare med lista på lag
Visa hello world Prata om directives Bygg vidare med lista på lag
// $scope och $http är inbyggt i angularJS // TeamService är en egen service/modul som har en specifik uppgift TeamListController.$inject = ['$scope', '$http', 'TeamService'];
Exempel med egen controller-fil
Registreras i applikationen via "recept" som bygger upp objekten och gör dessa tillgängliga för DI. http://stackoverflow.com/questions/15666048/angularjs-service-vs-provider-vs-factory
Foto cc by: http://www.flickr.com/photos/seattlemunicipalarchives/
Visa ett exempel med controllers i olika filer
app/ ----- controllers/ ---------- mainController.js ---------- otherController.js ----- directives/ ---------- mainDirective.js ---------- otherDirective.js ----- services/ ---------- userService.js ---------- itemService.js ----- js/ ---------- bootstrap.js ---------- jquery.js ----- app.js views/ ----- mainView.html ----- otherView.html index.html
What if > 10 controllers?
app/ ----- shared/ // acts as reusable components or partials of our site ---------- sidebar/ --------------- sidebarDirective.js --------------- sidebarView.html ----- components/ // each component is treated as a mini Angular app ---------- home/ --------------- homeController.js --------------- homeService.js --------------- homeView.html ---------- blog/ --------------- blogController.js --------------- blogService.js --------------- blogView.html ----- app.module.js ----- app.routes.js assets/ ----- img/ // Images and icons for your app ----- css/ // All styles and style related files (SCSS or LESS files) ----- js/ // JavaScript files written for your app that are not for angular ----- libs/ // Third-party libraries such as jQuery, Moment, Underscore, etc. index.html