aboutsummaryrefslogtreecommitdiffstats
path: root/docs/content/guide/dev_guide.services.$location.ngdoc
diff options
context:
space:
mode:
authorMisko Hevery2011-12-14 02:55:31 +0100
committerMisko Hevery2012-01-25 11:53:59 -0800
commit4804c83b7db5770d5d02eea9eea4cc012b4aa524 (patch)
treebe5ae1743179704cc1638f186cddba8d6e3fa37d /docs/content/guide/dev_guide.services.$location.ngdoc
parente2b1d9e994e50bcd01d237302a3357bc7ebb6fa5 (diff)
downloadangular.js-4804c83b7db5770d5d02eea9eea4cc012b4aa524.tar.bz2
docs(compiler): update the compiler docs
Diffstat (limited to 'docs/content/guide/dev_guide.services.$location.ngdoc')
-rw-r--r--docs/content/guide/dev_guide.services.$location.ngdoc52
1 files changed, 26 insertions, 26 deletions
diff --git a/docs/content/guide/dev_guide.services.$location.ngdoc b/docs/content/guide/dev_guide.services.$location.ngdoc
index 2afbf1d2..f81bc599 100644
--- a/docs/content/guide/dev_guide.services.$location.ngdoc
+++ b/docs/content/guide/dev_guide.services.$location.ngdoc
@@ -434,40 +434,40 @@ In this examples we use `<base href="/base/index.html" />`
this.$location = $location;
}
- angular.widget('ng:address-bar', function(tpl) {
- return function(elm) {
- var browser = browsers[elm.attr('browser')],
- input = angular.element('<input type="text" />').val(browser.url()),
- delay;
-
- input.bind('keypress keyup keydown', function() {
- if (!delay) {
- delay = setTimeout(fireUrlChange, 250);
- }
- });
-
- browser.url = function(url) {
- return input.val(url);
- };
-
- elm.append('Address: ').append(input);
-
- function fireUrlChange() {
- delay = null;
- browser.urlChange(input.val());
- }
- };
- });
-
function initEnv(name) {
var root = angular.element(document.getElementById(name + '-mode'));
- angular.bootstrap(root, [function($locationProvider, $provide){
+ angular.bootstrap(root, [function($compileProvider, $locationProvider, $provide){
$locationProvider.html5Mode = true;
$locationProvider.hashPrefix = '!';
$provide.value('$browser', browsers[name]);
$provide.value('$document', root);
$provide.value('$sniffer', {history: name == 'html5'});
+
+ $compileProvider.directive('ngAddressBar', function() {
+ return function(scope, elm, attrs) {
+ var browser = browsers[attrs.browser],
+ input = angular.element('<input type="text" />').val(browser.url()),
+ delay;
+
+ input.bind('keypress keyup keydown', function() {
+ if (!delay) {
+ delay = setTimeout(fireUrlChange, 250);
+ }
+ });
+
+ browser.url = function(url) {
+ return input.val(url);
+ };
+
+ elm.append('Address: ').append(input);
+
+ function fireUrlChange() {
+ delay = null;
+ browser.urlChange(input.val());
+ }
+ };
+ });
}]);
root.bind('click', function(e) {
e.stopPropagation();