edit: i update the code block as i make changes and the errors at the bottom
so i am inside my directive. I want to do a refresh of the page. (like after a scroll to refresh)
What's the right angular way to do this, in angular? (I can hack it in with jquery but i am trying to do things the angular way)
my plan was to get the url i am currently at.
And then set the $location.path(my current url);
it doesn't work because i cant seem to figure out what my current url is.
// USAGE: <div alert-bar alertMessage="myMessageVar"></div>
angular.module('foo.directives').
directive('iScroll', ['$rootScope', '$parse', '$location', function($rootScope, $parse, $location) {
return {
restrict: 'C',
link: function(scope, elem, attrs) {
console.log("iscroll!");
//document.addEventListener('touchmove', function (e) { e.preventDefault(); }, false);
new iScroll('wrapper', { useTransition: false, bounce:true, vScroll:true,
onScrollEnd: function ($location) {
console.log("onScrollEnd");
//x=$location.path();
x=$location.url();
console.log("url is "+x);
},
} );
}
}
}]);
now yields
Uncaught TypeError: Cannot call method 'url' of undefined
// USAGE: <div alert-bar alertMessage="myMessageVar"></div>
angular.module('foo.directives').
directive('iScroll', ['$rootScope', '$parse', '$location', function($rootScope, $parse, $location) {
return {
restrict: 'C',
link: function(scope, elem, attrs) {
console.log("iscroll!");
//document.addEventListener('touchmove', function (e) { e.preventDefault(); }, false);
new iScroll('wrapper', { useTransition: false, bounce:true, vScroll:true,
onScrollEnd: function ($location) {
console.log("onScrollEnd");
//x=$location.path();
x=$location.path();
console.log("path is "+x);
},
} );
}
}
}]);
now yields
Uncaught TypeError: Cannot call method 'path' of undefined