Creative crypter
Creative crypter

Reputation: 1496

Symfony - Angular routing

I have a symfony application which works in a subdirectory:

www.example.com/subdirectory

At this point my application is routed client side with angularjs-framework:

app.config(["$routeProvider", function($routeProvider) {
    $routeProvider.
        when('/', {
            redirectTo: '/homepage'
        }).
        when('/homepage', {
            templateUrl: 'index1.html',
            controller: 'HomepageCtrl'
        }).
        when('/contact', {
            templateUrl: 'index2.html',
            controller: 'ContactCtrl'
        }).
        otherwise({
            redirectTo: '/homepage'
        });
}]);

When the site is loaded:

www.example.com/subdirectory

it automatically changes to:

www.example.com/subdirectory#/homepage

But it should be

www.example.com/subdirectory/#homepage

Anybody could help me to get this working?

Thanks and greetings!

Upvotes: 2

Views: 260

Answers (1)

Pankaj Parkar
Pankaj Parkar

Reputation: 136144

For changing the base URL of your application you could use <base href="/subdirectory/"> inside your head tag of page.

But as per your $routeProvider setting the remaining part of URL seems OK to me. If you really wanted to change it then you need to replace

/homepage

with

homepage

in config phase of angular.

Upvotes: 3

Related Questions