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

Popular posts from this blog

java - Andrioid studio start fail: Fatal error initializing 'null' -

android - Gradle sync Error:Configuration with name 'default' not found -

StringGrid issue in Delphi XE8 firemonkey mobile app -