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:

/*controller with POST in my Angular-file*/
.controller('dataCtrlMain', function ($scope, $http) {
  $scope.submitForm = function (form) {
  $http.post('http://localhost:8080/bonita', $scope.user)
        .success(function (data) {
          console.log('data:', data);
        })
        .error(function (data) {
          console.log('Error:', data);
        });
  };

/* 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