Angular for Designers
Join the DZone community and get the full member experience.Join For Free
a colleague asked me "is it about graceful degradation ?", and the answer is no it's not. it is about the ability of a designer or a ux specialist to lead the behavior as well as the aesthetics of a web-application, during development.
a minimal angular app, with an overlay
note too that all the content for this app is static html. normally you'd use angular to bind in data from json. the two "previous blogged about" articles do just that. for this blog entry, i'm only trying to sell the view-all-panels-together aspect of the proposition.
commenting out the angular import
this is the big benefit for me. designers, or indeed newbies to a project, will load up an angular page in a running app with angular turned off. they will then be able to see all the panels/divs/overlays concurrently visible within the page, whether or not the application would function like that. all will be very-nearly styled appropriately, as css will still work as it would in the final app.
here is the same one-page demo as before, with angular 'turned off'. note the 'kittens' button does not function.
here is the source for it . i swear the only difference is the 'script' tag that would have dragged in angular - i've commented it out.
hacks i've had to do to make this work
'overlayclass' is one scoped variable that is only used once. it's definition:
$scope.overlayclass = "white_content";
the place where it is used is the overlay div itself:
<div ... ng-class="overlayclass">
this is a hack that is needed. here is what happens without it . note that the second div is not visible (the button is still non functioning)
here is the source for it . the only difference versus the previous one is the ng-class usage has been swapped 'back' to a hardcoded class="white_content", as per ordinary html usage.
this kludge is needed to support the design-mode i'm advocating for. at least, unless the angular team make class vs style co-existence a little smoother :)
other 'new' tools a designer would use
tin.cr - edit your css while playing with a functional angularjs app, and save directly back to the file-system (before doing a commit).
angular batarang - fiddle or inspect your angular model in your running angular app. here's that running:
a github thought
obviously i'm misusing github here. i could have had three repos or three branches, and used github's own diff mechanism to show that the differences i claim, are the only differences. but for a few stymying factors - 1) you can fork your own repo, and 2) you can only have one branch that publishes to github-pages. i hope that one of the things those guys do with their $100m is enhance the capabilities of github-pages :)
Published at DZone with permission of Paul Hammant, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.