angular.module('project', [], function($routeProvider, $locationProvider) {
$routeProvider.
when(
...)
.otherwise({redirectTo:'/'});
I upgraded from rc8 to 1.0.0 and the problem has gone away, routes that are not specified by the routeProvider will trigger a page loadTo view this discussion on the web visit https://groups.google.com/d/msg/angular/-/flEYO-s5zi0J.
On Saturday, June 23, 2012 1:42:12 PM UTC-7, Andy Joslin wrote:Just a guess... but try an empty .otherwise()?--angular
.module('admin.Rooms', [])
.config(['$routeProvider','$locationProvider',function ($routeProvider,$locationProvider) {
$locationProvider.html5Mode(true)
$routeProvider
.when('/admin/rooms/:room_id', {template: '/lib/adminRooms/views/room'})
.when('/admin/rooms', {template: '/lib/adminRooms/views/roomlist'}).otherwise({});}])
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To post to this group, send email to ang...@googlegroups.com.
To unsubscribe from this group, send email to angular+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/angular?hl=en.
I've still got this problem using angular 1.0.1.Unspecified routes are not causing a page load.Can anyone help?
Can you give an example? If you put http://... In your urls it should trigger a reload.
... sent from my tablet
--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at http://groups.google.com/group/angular?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.
var app = angular.module('app', []);
app.config(['$routeProvider', '$locationProvider', function ($routeProvider, $locationProvider) {
$routeProvider.
when('/pneumatici/:chunka', {}).
when('/pneumatici/:chunka/:chunkb', {});
$locationProvider.html5Mode(true);
}]);
Plus:app.controller('appCtrl', ['$scope', '$route', '$routeParams', '$location', function ($scope, $route, $routeParams, $location) {
$scope.$on('$routeChangeSuccess', function (current,previous) {
if (!($location.path().indexOf('/pneumatici') === -1)) {
$scope.chunka = $route.current.params.chunka; $scope.chunkb = $route.current.params.chunkb;
/** do my stuff with chunka and chunkb **/
} else {
window.location.href = $location.path();
}
});
angular.element("a").prop("target", "_self");