diff options
| author | Vojta Jina | 2011-11-15 11:56:13 -0800 | 
|---|---|---|
| committer | Vojta Jina | 2011-11-21 17:49:49 -0800 | 
| commit | 3548fe31398c1287817e486577a08902cf916a61 (patch) | |
| tree | eb27a7dc3d697be15c235aaccdb4a61bf390befa /src/widgets.js | |
| parent | 29f9e2665d8b771a6226870fc8fd2c4c94d7a2c0 (diff) | |
| download | angular.js-3548fe31398c1287817e486577a08902cf916a61.tar.bz2 | |
feat(service.$autoScroll): scroll to hash fragment
- whenever hash part of the url changes
- after ng:view / ng:include load
Diffstat (limited to 'src/widgets.js')
| -rw-r--r-- | src/widgets.js | 8 | 
1 files changed, 5 insertions, 3 deletions
diff --git a/src/widgets.js b/src/widgets.js index c4494b29..f6cdb977 100644 --- a/src/widgets.js +++ b/src/widgets.js @@ -90,7 +90,7 @@ angularWidget('ng:include', function(element){      this.directives(true);    } else {      element[0]['ng:compiled'] = true; -    return ['$xhr.cache', '$element', function(xhr, element){ +    return ['$xhr.cache', '$autoScroll', '$element', function($xhr, $autoScroll, element) {        var scope = this,            changeCounter = 0,            releaseScopes = [], @@ -114,7 +114,7 @@ angularWidget('ng:include', function(element){            releaseScopes.pop().$destroy();          }          if (src) { -          xhr('GET', src, null, function(code, response){ +          $xhr('GET', src, null, function(code, response) {              element.html(response);              if (useScope) {                childScope = useScope; @@ -122,6 +122,7 @@ angularWidget('ng:include', function(element){                releaseScopes.push(childScope = scope.$new());              }              compiler.compile(element)(childScope); +            $autoScroll();              scope.$eval(onloadExp);            }, false, true);          } else { @@ -555,7 +556,7 @@ angularWidget('ng:view', function(element) {    if (!element[0]['ng:compiled']) {      element[0]['ng:compiled'] = true; -    return ['$xhr.cache', '$route', '$element', function($xhr, $route, element){ +    return ['$xhr.cache', '$route', '$autoScroll', '$element', function($xhr, $route, $autoScroll, element) {        var template;        var changeCounter = 0; @@ -572,6 +573,7 @@ angularWidget('ng:view', function(element) {              if (newChangeCounter == changeCounter) {                element.html(response);                compiler.compile(element)($route.current.scope); +              $autoScroll();              }            });          } else {  | 
