Wednesday 15 May 2013

mongolab - How to return/edit REST resource with AngularJS & Restangular -


Use for AngularJS, continue to get object object from Mangal.

I am sure that they do this with promise, but it is not certain how to come / use it from the old Java OO experience.

(Side note, like some well-known javascript, some books or resources, will help me understand the 'new' JavaScript style?)

Small Web App is for disabled students and Students have to input / edit, they update the time spent after school and update output reports every month for their parents / carers. > Here is the code that undefines when popping up a new form (AngularJS Boostprop UI Model)

I personally think merge & amp; Documentation is a great addition, so it expects not to immerse others - it just does not know me enough.

Thank you in advance

app.js ...

  $ scope.editStudent = function (id) {$ scope.mystudent = restangular. One ("student", id); Console.log ($ scope.myStudent); }    

I am the creator of the privilege :). Maybe I can help with this a little bit.

So, first of all you need to configure the BASUAL for the privilege. For Mongolab, you usually have a base URL which is similar to all of them.

Once you do this work, you have to check the response format:

If your feedback is wrapped in another object or envelope, Opening "requires the exponent, check out

Once you have found it, you can start requesting.

The promise comes back from all the specific requests. Angular's template is able to handle the word and they are able to show promise results in HTML. Therefore, if the promise is not being resolved yet, it does not show anything and once you receive the data from the server, it appears in the template.

If you get an object you want to edit and then put one, in that case, you can not work with promise, as you need to change the values.

If so, you get the result of the promise $ variable variables

For this, you can:

  resitional.one ("student", id) .get () Then (function (serverproduct) {$ scope. MyStudent = serverStudent;});   

In this way, once the student gives the student, you will provide it for Scope Variable.

Hope it helps! Otherwise, leave me a comment here!

Also see this example, Mongolab probably will help you



No comments:

Post a Comment