Is it possible to render x.jade partial in angular?

放肆的年华 提交于 2019-11-28 20:11:39

问题


The following code works if i was rendering some.html instead of some.jade.

angular.module('myApp', []).
  config(['$routeProvider', function($routeProvider) {
  $routeProvider.
      when('/', {templateUrl: 'partials/some.jade',  controller: myAppController}).      
      otherwise({redirectTo: '/login'});
}]);

Is it possible to render a jade file as a partial in angular?


回答1:


Yes it is possible. Look at the following link

Two important points to note are:

  1. templateUrl: 'partials/some' instead of templateUrl: 'partials/some.jade' and
  2. Add the following in routes: ( the code is for expressjs in node)

    app.get('/partials/:name', function (req, res)
     { var name = req.params.name;
       res.render('partials/' + name);
    });`
    
  3. Quit and relaunch node/express server.



来源:https://stackoverflow.com/questions/18746063/is-it-possible-to-render-x-jade-partial-in-angular

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!