WebAPI REST Routing For AngularJS and ExtJS

As most of my readers know, I’ve done a lot of work with the JavaScript libraries made by Sencha (ExtJS and SenchaTouch).  The typical JSON sent down to the requesting web application looks like the following with both Sencha products.{ "data": [ { "shirtSize": "Mens-4XL", "id": 30 }, { "shirtSize": "Mens-5XL", "id": 31 }, { "shirtSize": "Mens-6XL", "id": 32 } ], "total": 34, "success": true } Notice that it is a single JavaScript object that has a property named data which is the array we are interested in. AngularJS’s Resource api expects just the data array by default without the nice wrapping with total and status.  That is, Angular just … Continue Reading

Why Refactoring Support in a JavaScript IDE Is so Important

image.png

As I’m building out a new version of the Silicon Valley Code Camp web site in AngularJS, I’m running into the very common case where I have not created my program files hierarchy optimally.  What I have now (as seen from JetBrains WebStorm) is the following: I realize now that I’m adding the login screen that I really should have an app folder account and registration should be a subfolder of that.  To make that change without a good tool (like WebStorm), I would need to go into my file manager and copy the files I want, then go into my index.html file and manually change all those directory references.  Likely (because I’m not that good at that kind of work) I’d make at least one mistake and have to come back and revisit … Continue Reading

Angular and ngAnnotate, a Better Way

image.png

I recently posted to StackOverflow a question and example of how adding a dependency injection to my AngularJS app did not seem to matter regarding my program running correctly.  The answer I got back was clear, but somewhat disconcerting.  Basically, the answer is that Angular takes care of the problem for me in development but when I move to production with minification, it will fail.  Well, that sucks on so many levels. Here is an example of code that shows the problem. angular.module('svccApp', []); angular.module('svccApp'). factory('bareService', [ function() { var myValue = {}; myValue.str1 = 'xyz'; return myValue; } ]); angular.module('svccApp') .controller('MyController', … Continue Reading

Using Gulp to Build My JavaScript AngularJS App

Having spent the past few hours learning how Gulp works, and finally customizing it for my scenario, I feel the need to share.  As I was figuring it out, it seems that many have had my thought also.  So, for those not acquainted with Gulp, basically, it's  is a build system of sorts that works with Node.JS. It's got a huge community of tasks that you can use and pipeline together. Basically, here is what my gulpfile.js does: Compiles my SASS (scss) into both expanded and minified CSS Runs jshint on all my JavaScript Concatinates all my JavaScript together and makes both minified and non-minified versions of it Optimizes my images Copies my AngularJS web templates to a production directory Copies my JSON files to a … Continue Reading

Follow

Get every new post delivered to your Inbox

Join other followers: