karlsruher entwicklertag 2013 to use plain css animations and transitions css class names for...

26
Web Applications with Karlsruher Entwicklertag 2013

Upload: lynga

Post on 25-May-2018

221 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Karlsruher Entwicklertag 2013 to use plain CSS Animations and Transitions CSS class names for 'enter', 'move' and 'leave' custom JS functions possible open for animation libs directives

Web Applications with

Karlsruher Entwicklertag 2013

Page 2: Karlsruher Entwicklertag 2013 to use plain CSS Animations and Transitions CSS class names for 'enter', 'move' and 'leave' custom JS functions possible open for animation libs directives

Philipp BurgmerSenior Software Engineer / ConsultantWeigleWilczek [email protected] Focus: Frontend, Web Technologies

About me

Page 3: Karlsruher Entwicklertag 2013 to use plain CSS Animations and Transitions CSS class names for 'enter', 'move' and 'leave' custom JS functions possible open for animation libs directives

GWTUI in Java / XMLhard to use JS libs / scatters ui logic"Java World" instead of "Web World"

JSFUI on Servera lot HTTP requests just to update UIhard to use JS libs / scatters ui logic

Flexbased on FlashAdobe discontinues developement

Web Apps until now

Page 4: Karlsruher Entwicklertag 2013 to use plain CSS Animations and Transitions CSS class names for 'enter', 'move' and 'leave' custom JS functions possible open for animation libs directives

MXML and ActionScript instead of HTML and JavaScript

Page 5: Karlsruher Entwicklertag 2013 to use plain CSS Animations and Transitions CSS class names for 'enter', 'move' and 'leave' custom JS functions possible open for animation libs directives

Frontend runs completely in the browserStateful UI, stateless serverServer delivers static resourcesServer delivers dynamic dataHTML, CSS and JavaScript as UI Toolkit

Web Apps from now on

Page 6: Karlsruher Entwicklertag 2013 to use plain CSS Animations and Transitions CSS class names for 'enter', 'move' and 'leave' custom JS functions possible open for animation libs directives

HTML enhanced for web apps!angularjs.com

client / browser JS frameworkrich browser applicationsbrings core frontend concepts and features to the browserextends html instead of abstracting or wrapping itlets you extend html to fit your needs

What is AngularJS?

Page 7: Karlsruher Entwicklertag 2013 to use plain CSS Animations and Transitions CSS class names for 'enter', 'move' and 'leave' custom JS functions possible open for animation libs directives

Model View Controller PatternTwo Way Data-BindingDependency InjectionModulesServicesDirectivesFilter

Separation of ConcernsTestable Code

Core Concepts

Page 8: Karlsruher Entwicklertag 2013 to use plain CSS Animations and Transitions CSS class names for 'enter', 'move' and 'leave' custom JS functions possible open for animation libs directives

Two Way Data-BindingAdd Logic with a ControllerFormat Values with FiltersAdjust markup with Filters

Demo

Page 9: Karlsruher Entwicklertag 2013 to use plain CSS Animations and Transitions CSS class names for 'enter', 'move' and 'leave' custom JS functions possible open for animation libs directives

extend HTMLTags, Attributes, CSS classesencapsulate DOM manipulationsproceeded by AngularJS compiler

Directives

Page 10: Karlsruher Entwicklertag 2013 to use plain CSS Animations and Transitions CSS class names for 'enter', 'move' and 'leave' custom JS functions possible open for animation libs directives

Blink on Steroids SpeedNew Tags with Directives

Demo

Page 11: Karlsruher Entwicklertag 2013 to use plain CSS Animations and Transitions CSS class names for 'enter', 'move' and 'leave' custom JS functions possible open for animation libs directives

Deep linkingPartial Views / Templating

angularjs.com

Views & Routes

function $RouteProvider(){

this.when = function(path, route) { };

this.otherwise = function(params) { );

this.$get = function($rootScope, $location, $routeParams, $q, $injector, $http, $templateCache) {

...

return $route;

};

}

Page 12: Karlsruher Entwicklertag 2013 to use plain CSS Animations and Transitions CSS class names for 'enter', 'move' and 'leave' custom JS functions possible open for animation libs directives

Small crud app -> with own URL bar: localFancy stuff: bouncy ballsThis Presentation

Demo

Page 13: Karlsruher Entwicklertag 2013 to use plain CSS Animations and Transitions CSS class names for 'enter', 'move' and 'leave' custom JS functions possible open for animation libs directives

new in Version 1.2easy to useplain CSS Animations and TransitionsCSS class names for 'enter', 'move' and 'leave'custom JS functions possibleopen for animation libsdirectives must support ng-animate

ng-repeatng-viewng-includeng-showng-hide

Animations

Page 15: Karlsruher Entwicklertag 2013 to use plain CSS Animations and Transitions CSS class names for 'enter', 'move' and 'leave' custom JS functions possible open for animation libs directives

ExtensibilityTemplatingLocalizationValidationREST supportEmbeddableTestable

Built-in Features

Page 16: Karlsruher Entwicklertag 2013 to use plain CSS Animations and Transitions CSS class names for 'enter', 'move' and 'leave' custom JS functions possible open for animation libs directives

Directivesng-clickng-classng-show / ng-hideng-includeng-viewng-pluralizeng-repeatng-submit...

FiltercurrencydatefilterjsonlimitTolowercasenumberorderByuppercase

Serviceshttplocationlogqresourceroutetimeoutwindow...

Built-in Features

Page 17: Karlsruher Entwicklertag 2013 to use plain CSS Animations and Transitions CSS class names for 'enter', 'move' and 'leave' custom JS functions possible open for animation libs directives

Clean separation of Frontend and BackendFeatures like DI, MVC and DataBinding in the browserSeamless integration with other frameworksLets you use all the cool new Web / JS tools

Easy to learnDocumentation with a lot of runnable examplesLarge community and fast growing eco systempowered and used by Google

Try it!

Conclusion

Page 18: Karlsruher Entwicklertag 2013 to use plain CSS Animations and Transitions CSS class names for 'enter', 'move' and 'leave' custom JS functions possible open for animation libs directives

Philipp [email protected]

Page 19: Karlsruher Entwicklertag 2013 to use plain CSS Animations and Transitions CSS class names for 'enter', 'move' and 'leave' custom JS functions possible open for animation libs directives

Java with Google Guice

Dependency Injection

// no dependency management

public class MyModule extends AbstractModule {

protected void configure() {

// bind with interface

bind(Service.class).to(ServiceImpl.class);

// bind with scope

bind(OtherService.class).in(Singleton.class);

// bind with alias

bindConstant().annotatedWith(Names.named("port")).to(8080);

}

}

Page 20: Karlsruher Entwicklertag 2013 to use plain CSS Animations and Transitions CSS class names for 'enter', 'move' and 'leave' custom JS functions possible open for animation libs directives

Java with Google Guice

Dependency Injection

@Singleton

public class ServiceImpl {

@Inject

public ServiceImpl(final OtherService otherService) { }

}

// manual or by configured framework

final Injector injector = Guice.createInjector(new MyModule());

final Service service = injector.getInstance(Service.class);

Page 21: Karlsruher Entwicklertag 2013 to use plain CSS Animations and Transitions CSS class names for 'enter', 'move' and 'leave' custom JS functions possible open for animation libs directives

JavaScript with AngularJS

Dependency Injection

// dependency management and di configuration

angular.module('myModule', ['moduleOfOtherLibrary'])

// no scopes, services are singletons by definition

.service('usefulService', function($window) {

function somethingPrivate() { }

return function() {

somethingPrivate();

$window.close();

}

};

Page 22: Karlsruher Entwicklertag 2013 to use plain CSS Animations and Transitions CSS class names for 'enter', 'move' and 'leave' custom JS functions possible open for animation libs directives

JavaScript with AngularJS

Dependency Injection

// dependency management and di configuration

angular.module('myModule', ['moduleOfOtherLibrary'])

// no scopes, services are singletons by definition

.service('usefulService', function(a) {

function somethingPrivate() { }

return function() {

somethingPrivate();

a.close();

}

};

Page 23: Karlsruher Entwicklertag 2013 to use plain CSS Animations and Transitions CSS class names for 'enter', 'move' and 'leave' custom JS functions possible open for animation libs directives

JavaScript with AngularJS

Dependency Injection

// dependency management and di configuration

angular.module('myModule', ['moduleOfOtherLibrary'])

// no scopes, services are singletons by definition

.service('usefulService', ['$window', function(a) {

function somethingPrivate() { }

return function() {

somethingPrivate();

a.close();

}]

};

Page 24: Karlsruher Entwicklertag 2013 to use plain CSS Animations and Transitions CSS class names for 'enter', 'move' and 'leave' custom JS functions possible open for animation libs directives

JavaScript with AngularJS

Dependency Injection

var service = function(a) {

return function() {

a.close();

}

}

service.$inject = ['$window'];

angular.module('myModule', ['moduleOfOtherLibrary'])

.service('usefulService', service)

.constant('port', 80)

Page 25: Karlsruher Entwicklertag 2013 to use plain CSS Animations and Transitions CSS class names for 'enter', 'move' and 'leave' custom JS functions possible open for animation libs directives

Additional parameters and overridden DI values

Dependency Injection

// get the injector via static call

var $injector = angular.injector();

// or via injection

function($injector) { }

var functionA = function(serviceA) { };

$inject.invoke(functionA);

var functionB = function(serviceA, nonDIValue) { };

var locals = { nonDIValue: 1 };

$inject.invoke(functionB, locals);

Page 26: Karlsruher Entwicklertag 2013 to use plain CSS Animations and Transitions CSS class names for 'enter', 'move' and 'leave' custom JS functions possible open for animation libs directives

Philipp [email protected]