问题
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:
templateUrl: 'partials/some'
instead oftemplateUrl: 'partials/some.jade'
andAdd 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); });`
Quit and relaunch node/express server.
来源:https://stackoverflow.com/questions/18746063/is-it-possible-to-render-x-jade-partial-in-angular