angularjs - secondary level routing in node js changes root directory -


in web project using angular js , node js both @ same time.

for routing url in angular js have used below code

app.config(function($routeprovider,$locationprovider) { $routeprovider .when("/expert/:expertname*", {     templateurl : "public/views/individual_expert.html",     controller:"usercontroller" }) .otherwise({         redirectto:"/home"     })     $locationprovider.html5mode(true); }); 

in above case url generated follows , page displayed properly.

http://localhost:3002/expert/58200b0f3574801df4ef767c

this same thing executed when refresh page same url browser node js code executed. code snippet below

app.get('/expert/:expertname',function(req,res){     if(req.session.usersession!=null){         if(req.session.usersession.type=="member")             res.sendfile('index/member_index.html');         else if(req.session.usersession.type=="expert")             res.sendfile('index/expert_index.html');         else if(req.session.usersession.type =="admin")             res.sendfile('index/admin_index.html');         else             res.sendfile('index/visitor_index.html');     }     else         res.sendfile('index/visitor_index.html'); }); 

at time errors see on browser follows

1.) css paths changed.

2.) js paths changed.

the thing noticed was changing root directory "expert" , trying search import in directory.

i stuck @ long. thank in advance helping me out.

you can comment if don't question correctly.

in view html page, have /css/style.css instead of normal css/style.css


Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - IE9 error '$'is not defined -