AngularJS - Bootstrapping data into a service on page load -
In an angular application, I'm trying to use a custom service to catch the main data of the app, "Items" However, I want to boot on the data on the initial page load to get it to avoid a different Ajax request on the server.
app.factory ('items', function) var itemsService = {}, item = [] item; Service.list = function () {return item;} item itemservice = add and on the backend I am using node.js + expressjs + jade, so I use data In the page I'm injected:
! {JSON.stringify (item)}
From the server your bootstrap data is in the global form Keep Javascript Variable
Comments
Post a Comment