Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I'm using angularsj routing inside my asp.net mvc application.

Here's my configs for $routeProvider :

.config(['$routeProvider', '$locationProvider', function ($routeProvider, $locationProvider) {

    $locationProvider.html5Mode(true);
    $routeProvider
      .when('/Organization/Employee/:id', {
          controller: 'UserCtrl',
          templateUrl: '/Areas/Organization/App/user/partial/info.html'
      })
      .when('/Organization/Employee/:id/edit', {
          controller: 'EditCtrl',
          templateUrl: '/Areas/Organization/App/user/partial/edit.html'
      })
    .otherwise({        
        redirectTo: '/'
    })
    ;
}])

As you can see there only two routes I want to be handled by angularjs. How I can make use asp.net for handling routing for the otherwise case?

share|improve this question

1 Answer 1

up vote 0 down vote accepted
  .otherwise({
      controller: function ($location, $window) {
          $window.location.href = $location.path();
          return false;
      },
      template: ""
  });

That did the trick. But blink with an empty ng-view first. Maybe someone know's how to get rid of that blink?

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.