15 Jul '14, 4pm

Preload Resource Data into AngularJS

Preloading, or bootstrapping, data resources from the server via HTML is a common technique used in JavaScript web development. This technique allows the application to avoid making an extra HTTP request to get that initial data for rendering on the page. Unfortunately, there isn’t a mechanism built into AngularJS that allows for preloading resources into the initial HTML page. Yet, the following implementation can be utilized for such a purpose. First, a directive needs to exist: angular.module("myApp", []). directive("preloadResource", function() { return { link: function(scope, element, attrs) { scope.preloadResource = JSON.parse(attrs.preloadResource); element.remove(); } }; }); Now, this directive can be used in the HTML that is sent by the initial request, and populated with JSON data: <div ng-cloak preload-resource="<%= UserSerializer.new(@user).to_json %>"></div> T...

Full article: http://robots.thoughtbot.com/preload-resource-data-into-a...

Tweets

Largest Lithium Resource Deal Spurred by Batter...

renewableenergyworld.com 16 Jul '14, 3pm

Consumption of lithium doubled in the decade through 2012, and is growing even faster now. Albemarle expects demand to inc...

How to Wire Up Ruby on Rails and AngularJS as a...

angularonrails.com 22 Jul '14, 1pm

# spec/controllers/groups_controller_spec.rb require 'spec_helper' # This spec was generated by rspec-rails when you ran t...

How to Wire Up Ruby on Rails and AngularJS as a...

reddit.com 22 Jul '14, 1pm

Please try to keep submissions on topic and of high quality. Just because it has a computer in it doesn't make it programm...

New data shows big global jump in bus priority systems Is there one near you? @EMBARQNetwork http…

New data shows big global jump in bus priority ...

Bus rapid transit (BRT) is expanding worldwide, particularly in Asia and Latin America. Watch it grow on BRTdata.org. Phot...

How to Wire Up Ruby on Rails and AngularJS as a...

news.ycombinator.com 22 Jul '14, 1pm

We (10KB) have built our own CMS combining Rails and AngularJS. Our main goal for our CMS was to turn every website made w...

Blog- Maxis Postpaid pay-per-use (PPU) data usage is now capped at RM50...

Blog- Maxis Postpaid pay-per-use (PPU) data usa...

malaysianwireless.com 14 Jul '14, 8am

“Based on our findings, more than 1 in 2 postpaid users are not on any data plan. This means that they are exposed to extr...

life saver! #ruby #angularjs #progress #techsta...

coderberry.me 26 Jul '14, 10pm

Originally I had presented this topic at our local ruby users group . My typical workflow is to write a blog post before p...