alphabetical order of angular .js files should correspond to load order

293 views
Skip to first unread message

lenidot

unread,
Nov 14, 2012, 9:00:11 PM11/14/12
to ang...@googlegroups.com
Hi, I'm new to angular and with that huge caveat I would like to offer a suggestion.

I think the alphabetical order of the angular .js files should corresponded to the order
in which they need to be loaded.  It's a sensible default.

Currently my angular app needs:

angular.min.js
angular-resource.min.js

Because 'angular-' precedes 'angular.', in my application.js manifest, I can't just write:

//= require_tree ./vendor/angularjs

because the alphabetical order leads to the wrong load order:

<script src="/assets/vendor/angularjs/1.0.2/angular-resource.min.js?body=1" type="text/javascript"></script>
<script src="/assets/vendor/angularjs/1.0.2/angular.min.js?body=1" type="text/javascript"></script>

Which means I have to hard code the path to the angular.min.js in the manifest:

//= require vendor/angularjs/1.0.2/angular

The version number in the pathname creates a maintenance burden.

Simple fix would be to rename angular.min.js to angular-angular.min.js
and then alphabetical order and load order correspond.

If this has already been suggested - my apologies!

Leni.

Peter Bacon Darwin

unread,
Nov 15, 2012, 5:47:04 AM11/15/12
to ang...@googlegroups.com
Are you using Yeoman or something?  How are you hosting the files?
If are hosting them manually then you could just rename the files yourself?
Pete


--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To post to this group, send email to ang...@googlegroups.com.
To unsubscribe from this group, send email to angular+u...@googlegroups.com.
Visit this group at http://groups.google.com/group/angular?hl=en.
 
 

lenidot

unread,
Nov 15, 2012, 4:05:57 PM11/15/12
to ang...@googlegroups.com
My app is Rails.  Files are under app/assets/javascripts/vendor/angularjs/1.0.2.

I thought about renaming angular.min.js but I ended up hardcoding the version number in the application.js manifest file as the option least likely to surprise the developers who follow me in maintaining the app.

I just wanted to suggest that renaming angular.js to angular-angular.js would be consistent with a policy of 'sensible defaults'.

pin...@gmail.com

unread,
Nov 18, 2012, 7:33:28 AM11/18/12
to ang...@googlegroups.com
Globbing a directory and depending on file naming for correct inclusion order sounds like anything but a sensible default to me. If the order matters _you_ define the order.
Reply all
Reply to author
Forward
0 new messages