I am not familiar with servlets. But in general, from Web Api stand point,
you can create different end points on server side for each type of
actions. And from your client code, you will send $http request to
appropriate end point.
$http({url:'/serverapi/add :data:data'});
$http({url:'/serverapi/subtract :data:data'});
On Monday, June 30, 2014 8:47:31 AM UTC-4, CoderBoy wrote:
>
> I have AngularJs on client-side and Servlets on server-side.I want to
> manipulate my JSON data on client after performing some actions on the
> server.
>
> Suppose I have my Json data as
>
> var obj={"num1":20,"num2":5}
>
> Currently before sending my data (doPost) to server I attach a information
> about which operation I want to perform like this
>
> var data_to_send ={
> "operation":"Add", //"Mul" for multiply "Sub" for subtract etc
> "data":obj }
>
> After receiving my data on server I see my "operation" and send the "data"
> accordingly to the specific function and at last send
> manipulated/caluclated data back to client.
>
> Doing this is very tedious as I have many functions so I want to avoid
> if-else ladder. Is their any way around? Can I send data to specific
> function directly?
>
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.