javascript - AngularJS Ajaxify entire website -
i' working history api , jquery in order ajaxify website.
all links fires ajax calls retrieve page , replace actual content fetched content, user can navigate without page reload. how can achieve using angularjs ?
i took @ $location
doc, , created directive on links. directive stop default event , use $location.path()
set new url.
angular.module('directives.ajaxnavigation', []) .directive('a', ['$location', function($location) { return { link: function(scope, ielement, iattrs) { ielement.bind('click', function(e) { console.log(ielement.attr('href')); scope.$apply($location.path(ielement.attr('href'))); e.preventdefault(); }); } } }]);
how can capture "urlchange" event in order make ajax call each time fired ?
Comments
Post a Comment