How can I pass variables to the process using AngularJS and REST API?

1
0
-1

Hello!

I need help with Angular/Bonita interaction in my project. I have a task - create connection between external web forms and a process. I watched Bonita webinars about Angular. In the last one I saw a good tool for this task(Forms->Redirect to URL), but it's available only in subscription versions of Bonita. Now I'm trying to make the same thing in Community using AngularJS and REST like this:

  1. /*controller with POST in my Angular-file*/
  2. .controller('dataCtrlMain', function ($scope, $http) {
  3. $scope.submitForm = function (form) {
  4. $http.post('http://localhost:8080/bonita', $scope.user)
  5. .success(function (data) {
  6. console.log('data:', data);
  7. })
  8. .error(function (data) {
  9. console.log('Error:', data);
  10. });
  11. };
  12.  
  13. /* In my index.html I pass variables to controller: ng-submit="submitForm(dataForm)" in <form>, ng-model="user.name" and ng-model="user.email"*/

Maybe someone has an example how to do it better? I need an advice!

Any help would be appreciated!

Comments

Submitted by Sean McP on Thu, 04/23/2015 - 11:50

Have you tried doing the full rest call as a string first and then breaking it down to component variables etc. then making an AngularJS version of it.

Is the AJS code generating the correct form of rest? I print my call to the log to see if it looks right as well. Many times I've found the generated code is wrong and need to change things...

hope this helps regards

No answers yet.
Notifications