Skip to content
This repository has been archived by the owner on Oct 3, 2020. It is now read-only.

Commit

Permalink
fix(app.js): don't resolve state for empty string
Browse files Browse the repository at this point in the history
cburgdorf committed Jan 5, 2015
1 parent fe55086 commit 0da2dda
Showing 2 changed files with 20 additions and 13 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@
"sofa-url-construction-service": "~0.3.x",
"sofa-pages-service": "~0.1.0",
"sofa-checkout-service": "0.7.x",
"sofa-couch-service": "~0.8.x",
"sofa-couch-service": "~0.14.x",
"sofa-coupon-service": "~0.1.0",
"sofa-wishlist-service": "~0.2.1",
"sofa-image-resizer-service": "~0.2.x",
31 changes: 19 additions & 12 deletions src/app/app.js
Original file line number Diff line number Diff line change
@@ -289,18 +289,25 @@ angular.module('CouchCommerceApp', [
var navigationService = $injector.get('navigationService');
var $state = $injector.get('$state');

stateResolverService
.resolveState($location.path())
.then(function (state) {
$state.transitionTo(state.stateName, state.stateParams, { location: false });
}, function () {
// since we're generating HTML snapshots for search engines
// via prerender.io, we have to add this meta tag when the
// requested url actually returns a 404 error
// https://prerender.io/getting-started#404s
setPrerenderIOMetaTag('404');
navigationService.navigateToRootCategory();
});
var path = $location.path();

if (path.length === 0) {
navigationService.navigateToRootCategory();
}
else {
stateResolverService
.resolveState(path)
.then(function (state) {
$state.transitionTo(state.stateName, state.stateParams, { location: false });
}, function () {
// since we're generating HTML snapshots for search engines
// via prerender.io, we have to add this meta tag when the
// requested url actually returns a 404 error
// https://prerender.io/getting-started#404s
setPrerenderIOMetaTag('404');
navigationService.navigateToRootCategory();
});
}
});
})
.run(['couchService', 'stateResolverService', function (couchService, stateResolverService) {

0 comments on commit 0da2dda

Please sign in to comment.