angularjs - Dynamic route request render in express framework -
i want try dynamic routing. i'm using express framework node js server. here html code
<a href="/views/adminpanel?url={{mmenu.webaddress}}" ng-click="description(mmenu.webaddress)">{{mmenu.menuname}}</a>
in client side
$scope.description = function(url) { $http({'method' : 'get', 'url' : '/views/adminpanel/'+url; }).success(function(data) { }). error(function(data){ }) }
and in server side,
app.get('/views/adminpanel/url', function(req, res) { res.render('views/adminpanel/url'); });
this our routing process. how route request , mistake.
client $http({'method' : 'get', 'url' : '/views/adminpanel/'+url;
server app.get('/views/adminpanel/url'
unless client url variable = url
not match. believe want exposing url
param in uri.
app.get('/views/adminpanel/:url', function(req, res) { res.render('views/adminpanel/'+req.params.url); });
Comments
Post a Comment