角度路线:
angular.module('AMS', []).
config(['$routeProvider', function ($routeProvider) {
$routeProvider.
when('/dashboard', { templateUrl: '/Dashboard', controller: dashboardController }).
when('/settings', { templateUrl: '/Settings', controller: settingsController }).
otherwise({ redirectTo: '/dashboard' });
}]);
样本:
/* client side route */
http://localhost:4117/#/dashboard
指着
/* controller that returns the partial */
http://localhost:4117/Dashboard
一切都按预期工作,但是如果我将相同的 url 放在浏览器中(没有前导/#/
),部分仍然会返回,这不好。
我该如何防止这种情况发生?