jquery - AngularJS link not working, but manual page refresh works fine -


i'm working on site in angularjs. i'm having issue when click on nav links ( tag href), url changing, page content not getting updated. if click on 'about' link, url gets modified #/about, not content. however, if manually refresh page now, content loads.

see site at: www.arunmahendrakar.com/nsm/

the links 'outside' angular , i'm not sure need add $apply function, if @ all.

the nsm.controller.js has routing , controller details, nsm.services.js has service gets data server , nsm.directives.js used highlight current link.

the index.html page uses bootstrap 3.0.

please let me know how can fix issue.

there's flicker on page when navigate, angular noticing change , trying update page.

the problem looks directives.js adds listener on $location.path()

scope.$watch('location.path()', function (newpath) {...}); 

according discussion here, want use

$scope.$watch(function() {return location.path()}, function(path) {...}); 

probably call $location.path() interfering routing.

edit

the following might explain it:

services.factory('pagedata', ['$resource', '$route',    function ($resource, $route) {        // done can run e2e tests :8000 port        //debugger;        var slug = ($route.current.params.slug || 'home') + '.txt';        return $resource('http://arunmahendrakar.com/nsm/data/:slug', { slug: slug });    }]);  services.factory('pagedataloader', ['pagedata', '$q',   function (pagedata, $q) {       return function () {           var delay = $q.defer();           pagedata.query(function (pdata) {               delay.resolve(pdata);           }, function () {               delay.reject('unable fetch data');           });           return delay.promise;       };   }]); 

the pagedata factory returns $resource object. called once, when page loads. pagedataloader factory returns function. function invoked each time pagedataloader instantiated.


Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -