I have an application with AngularJS on top of Play frameework. Want to use Play framework for services only. How do I make my angularjs routing work? My applicaton is always looking into in Play routes and never looks into Angularjs routes and so gives an error that route is not found.
I saw some examples in scala. didn't quite understand what they are doing.
Play Routings:
POST /location @controllers.Application.create()
GET /location/:id @controllers.Application.get(:Id)
GET / @controllers.Application.list()
AngularJS Routings:
config(['$routeProvider', '$locationProvider',
function($routeProvider, $locationProvider) {
console.log('In routeProvider()'+Date.now());
$routeProvider.
when('/', {
templateUrl: 'html/test.html',
controller: 'LocationsController'
}).
when('/location/:id', {
templateUrl: 'html/test.html',
controller: 'LocationController'
}).
when('/locations', {
templateUrl: 'html/test.html',
controller: 'LocationsController'
});
console.log('In routeProvider()..2'+Date.now());
$locationProvider.html5Mode(true); // .hashPrefix("!")
}])
For example, I want http://localhost:9000/ should hit Angularjs routings first. Angularjs controller will go get the data by requesting play service. Similarly, http://localhost:9000/location/100 needs to hit Angularjs first. Corresponding angularjs controller will get the data for that given id by requesting play's /location/100.
My applicaton is always looking into in Play routes and never looks into Angularjs routes and so gives an error that route is not found. How do I make both of them working? Thanks for any help.