FitzChivalry2 (23) [Avatar] Offline
#1
There have been several times throughout chapter 5 that I have been instructed to put some code in the app.js file, and I've had to scratch my head while I try to figure out WHERE to put it. Some additional guidance would be good.

For example, with the code in Listing 5.9, I put it before the .run(function($ionicPlatform) block, because it seemed to me like the .run should come last. However, your GitHub code had it following the run command. Is there a specific order that blocks need to be added, or is it really just a matter of preference?
jeremy.wilken (208) [Avatar] Offline
#2
Angular methods like .controller() .run() .config() all return the angular object, so you can chain those methods together. This is very common in jQuery. Angular loads everything before executing, and will do anything in the config() methods first (however the first config method that it hits does run first), then the run() methods, and then the rest of the application methods are lazy loaded when needed. You can have multiple config() and run() calls, and they all just queue up to execute. So in short, you do not have to put things in any particular order.

I've made a note to add some detail around this. To some degree it should be familiar to JavaScript developers how to chain methods, but I don't give enough context for this.
FitzChivalry2 (23) [Avatar] Offline
#3
I'm accustomed to jQuery chaining, but with that kind of chaining, the order matters. So, thank you for taking the time to explain that the order is up to the style/organization/whims of the coder, and that the order of the application of the code is determined by the JavaScript engine. smilie