Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 853999d

Browse files
docs(404 errors): provide a better 404 experience
It is a bit rough and ready but does a better job than nothing.
1 parent 53ec5e1 commit 853999d

File tree

4 files changed

+19
-2
lines changed

4 files changed

+19
-2
lines changed

docs/app/assets/Error404.html

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<h1>Welcome To AngularJS</h1>
2+
3+
<p>The page you were looking for is not here. Perhaps you were looking for something else...</p>
4+
5+
<div class="search-results-frame" ng-controller="Error404SearchCtrl">
6+
7+
<div ng-repeat="(key, value) in results" ng-show="value.length">
8+
<h4>{{ key }}</h4>
9+
<ul class="search-results">
10+
<li ng-repeat="item in value"><a ng-href="{{ item.path }}">{{ item.name }}</a></li>
11+
</ul>
12+
</div>
13+
</div>

docs/app/src/docs.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ angular.module('DocsController', [])
8787
breadcrumbPath += '/';
8888
});
8989
} else {
90-
$scope.currentArea = null;
90+
$scope.currentArea = NG_NAVIGATION['api'];
9191
$scope.breadcrumb = [];
9292
}
9393
});

docs/app/src/search.js

+4
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ angular.module('search', [])
4545
};
4646
}])
4747

48+
.controller('Error404SearchCtrl', ['$scope', '$location', 'docsSearch', function($scope, $location, docsSearch) {
49+
$scope.results = docsSearch($location.path().split(/[\/\.:]/).pop());
50+
}])
51+
4852
.factory('lunrSearch', function() {
4953
return function(properties) {
5054
if (window.RUNNING_IN_NG_TEST_RUNNER) return null;

docs/config/templates/indexPage.template.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ <h4 class="search-results-group-heading">{{ key }}</h4>
219219
</div>
220220
<div class="grid-right">
221221
<div id="loading" ng-show="loading">Loading...</div>
222-
<div ng-hide="loading" ng-include="currentPage.outputPath" onload="afterPartialLoaded()" autoscroll></div>
222+
<div ng-hide="loading" ng-include="currentPage.outputPath || 'Error404.html'" onload="afterPartialLoaded()" autoscroll></div>
223223
</div>
224224
</div>
225225
</section>

0 commit comments

Comments
 (0)