Search code examples
angularjsplayframeworkplayframework-2.2

Integrating AngularJS with Play framework


I have in my javascript the following AngularJS snippet:

        $http({
          method: 'POST',
          url: '/checklogin'
        })
       .then(function successCallback(response) {
             alert('It worked');
          }, function errorCallback(response) {
             alert('Error:' + response.status)
          });

That points in the routes file to a Play Controller:

POST /checklogin controllers.CheckLogin.index

The problem is that for each different Angular HTTP post I need to create an entry in routes (around 200 entries to create and maintain). Is there a way to avoid that?


Solution

  • You can use dynamic matching in routes and match your route somewhere in your application, but it isn't elegant solution.

    GET   /*yourRoute          AppController.matcher(yourRoute)