I am using Agularjs and ui-router in my application. I need to catch all urls except "signin" & "/" . All the urls must go to a state.
For example, the urls will be like
www.example.com/ // index
www.example.com/signin // signin page
www.example.com/cars
www.example.com/sports
www.example.com/politics
My current setup is
.config(function ($stateProvider, $urlRouterProvider, $locationProvider) {
$stateProvider
.state('index', {
url: "/",
templateUrl: 'partials/main.html',
controller: 'MainCtrl'
})
.state('signin', {
url: "/signin",
templateUrl: 'partials/signin',
controller: 'MainCtrl'
})
.state("otherwise", {
url: "*path",
templateUrl: 'partials/detail',
controller: 'MainCtrl'
});
I also tried
$urlRouterProvider.otherwise(function($injector, $location) {
$location.path($location.path());
})
But it doesnt load/show the page.