AngularJS ngMin Json Properties

One thing I ran across using these tools while trying to lazy load routes/pages was the inability to properly compress the JSON Object properties. One of the workarounds, specifically for a templateUrl in this case works like so (you have to specify that you want the function value, and not the first value returned from the array.

templateUrl: ["$stateParams", function($stateParams){
var templateUrl = "views/folder/" + $stateParams.page + ".html";
return templateUrl;
}][1],
About the Author: JeffAncel
http://jeffancel.com
A passionate web developer in St. Louis. Living on the edge with Rails, HTML5, CSS3 and any interesting libraries around. I love to spend time with the family, cook, develop web applications and play with our dragons. When I have nothing else to do, I socialize via twitter (@jancel) and facebook.

Leave a reply

© 2012 - Jeff Ancel
Wordpress Themes
Scroll to Top