aboutsummaryrefslogtreecommitdiffstats
path: root/src/widgets.js
diff options
context:
space:
mode:
authorVojta Jina2011-11-15 11:56:13 -0800
committerVojta Jina2011-11-21 17:49:49 -0800
commit3548fe31398c1287817e486577a08902cf916a61 (patch)
treeeb27a7dc3d697be15c235aaccdb4a61bf390befa /src/widgets.js
parent29f9e2665d8b771a6226870fc8fd2c4c94d7a2c0 (diff)
downloadangular.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.js8
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 {