diff options
| author | Vojta Jina | 2011-08-30 11:47:24 +0200 |
|---|---|---|
| committer | Igor Minar | 2011-09-26 23:51:53 +0200 |
| commit | 13f92de6246a0af8450fde84b209211a56397fda (patch) | |
| tree | 2e277d50a67f32dddcb1e7674ed8b1476881e014 /src | |
| parent | 2bc39bb0b4f81b77597bb52f8572d231cf4f83e2 (diff) | |
| download | angular.js-13f92de6246a0af8450fde84b209211a56397fda.tar.bz2 | |
feat(docs): use html5 history api for all routing in the docs app
- Configure our docs app to use new $location with html5 history api!
- Update simple node web server to serve index.html for all links
(rewritting).
- Update .htaccess file to serve index.html for all links (rewritting).
- At runtime determine the base href path and attach it to the DOM. We
needed the absolute URL to get all browsers to work well.
- Because of the above, we also need to dynamically determine all needed
js/css resources and add them to the DOM. This was needed because FF6
would eagerly fetch resources with wrong URL since the base element is
added to the dom at runtime.
- All content html files were moved to the partials directory, because
with the new html5 urls it was impossible to tell if request for
http://domain/api/angular.filter.html was an html5 url for the html
filter doc page, or an xhr/appcache request for the content html file
for the html filter.
f
Diffstat (limited to 'src')
| -rw-r--r-- | src/markups.js | 15 | ||||
| -rw-r--r-- | src/widgets.js | 10 |
2 files changed, 13 insertions, 12 deletions
diff --git a/src/markups.js b/src/markups.js index 5c9c14b4..1adad3e0 100644 --- a/src/markups.js +++ b/src/markups.js @@ -166,10 +166,10 @@ angularTextMarkup('option', function(text, textNode, parentElement){ <input name="value" /><br /> <a id="link-1" href ng:click="value = 1">link 1</a> (link, don't reload)<br /> <a id="link-2" href="" ng:click="value = 2">link 2</a> (link, don't reload)<br /> - <a id="link-3" ng:href="#!/{{'123'}}" ng:click="value = 3">link 3</a> (link, reload!)<br /> + <a id="link-3" ng:href="/{{'123'}}" ng:ext-link>link 3</a> (link, reload!)<br /> <a id="link-4" href="" name="xx" ng:click="value = 4">anchor</a> (link, don't reload)<br /> <a id="link-5" name="xxx" ng:click="value = 5">anchor</a> (no link)<br /> - <a id="link-6" ng:href="#!/{{value}}">link</a> (link, change hash) + <a id="link-6" ng:href="/{{value}}" ng:ext-link>link</a> (link, change hash) </doc:source> <doc:scenario> it('should execute ng:click but not reload when href without value', function() { @@ -185,10 +185,10 @@ angularTextMarkup('option', function(text, textNode, parentElement){ }); it('should execute ng:click and change url when ng:href specified', function() { + expect(element('#link-3').attr('href')).toBe("/123"); + element('#link-3').click(); - expect(input('value').val()).toEqual('3'); - expect(element('#link-3').attr('href')).toBe("#!/123"); - expect(browser().location().hash()).toEqual('!/123'); + expect(browser().location().path()).toEqual('/123'); }); it('should execute ng:click but not reload when href empty string and name specified', function() { @@ -205,9 +205,10 @@ angularTextMarkup('option', function(text, textNode, parentElement){ it('should only change url when only ng:href', function() { input('value').enter('6'); + expect(element('#link-6').attr('href')).toBe("/6"); + element('#link-6').click(); - expect(browser().location().hash()).toEqual('!/6'); - expect(element('#link-6').attr('href')).toBe("#!/6"); + expect(browser().location().path()).toEqual('/6'); }); </doc:scenario> </doc:example> diff --git a/src/widgets.js b/src/widgets.js index 1d0217b8..bd7c3d7f 100644 --- a/src/widgets.js +++ b/src/widgets.js @@ -1390,10 +1390,10 @@ angularWidget("@ng:non-bindable", noop); function MyCtrl($route) { $route.when('/overview', { controller: OverviewCtrl, - template: 'guide/dev_guide.overview.html'}); + template: 'partials/guide/dev_guide.overview.html'}); $route.when('/bootstrap', { controller: BootstrapCtrl, - template: 'guide/dev_guide.bootstrap.auto_bootstrap.html'}); + template: 'partials/guide/dev_guide.bootstrap.auto_bootstrap.html'}); }; MyCtrl.$inject = ['$route']; @@ -1401,9 +1401,9 @@ angularWidget("@ng:non-bindable", noop); function OverviewCtrl(){} </script> <div ng:controller="MyCtrl"> - <a href="#!/overview">overview</a> | - <a href="#!/bootstrap">bootstrap</a> | - <a href="#!/undefined">undefined</a> + <a href="overview">overview</a> | + <a href="bootstrap">bootstrap</a> | + <a href="undefined">undefined</a> <br/> |
