Sunday 15 May 2011

javascript - What is the correct way to load data on an edit page using angularjs? -


Working with angularjs and my data for the first time is loading slightly, basically when the user has an option to edit a task , We're reaching a web service to return data for work. Apart from that, there are 3 dropdowns on the page, so we have to use a service to return that data.

Displays the page, fills data for the job, and then fills the dropdown data at a time.

Can I wait for everyone to display the template until the data has been loaded? Or can you get data to load simultaneously?

Here is an example of a code that is getting the data:

  $ scope.task = Task.get ({id: TaskId}, function () {$ Scope.vendor.terms = Term.query ('', function () {$ scope.vendor.states = State.query ();});});   

These services are:

  Angular. Modules ('App Services', ['Ngrsource']). Factory ('Work', Function ($ Resources, BaseRub) {Return $ Resources (Base: '/ Work /: ID', {'ID': '@'}, {});}) .Feature ('Vendor ', $ Function ($ resource, basis)) {Return $ resource (base url +' / vendors /: id ', {' id ':' @ '}, {});}) .Feature (' statue ', function $ Resources, BaseRural) {Return $ Resources (BaseUrl + '/ states /: id', {'id': '@'}, {})}    

You can solve it is a property that you want, anything in your app. Set on the Jargon. Basically, this is a list of the promises that the controller should solve before the instantification and the footage will be loaded. This video will be played on the eggedo.o screencast

No comments:

Post a Comment