[英]Using AngularJS html5mode with express.js
Client-side: 客户端:
when("/page/:id", {
templateUrl: "partials/note-tpl.html",
controller : "AppPageController"
});
$locationProvider.html5Mode( true );
Html: HTML:
<a ng-href="/page/{{Page._id}}">{{Page.name}}</a>
Server-side: 服务器端:
app.use("/page/:id", function( req, res ) {
res.send( req.params )
});
As a result I get empty page or just object with id. 结果,我得到的是空白页或带有ID的对象。 What's wrong?
怎么了? Angular does not load note-tpl.html template
Angular不会加载note-tpl.html模板
Might be because of the conflict from express templating engine vs angular. 可能是由于表达模板引擎与角度冲突。
What view engine are you using? 您正在使用什么视图引擎?
The use of {{}} might be handled by express and not angular. {{}}的使用可以通过表达而非角度来处理。 You can either change the server view engine to use other keywords.
您可以更改服务器视图引擎以使用其他关键字。
Sounds like your server is not responding with note-tpl.html. 听起来您的服务器没有通过note-tpl.html进行响应。
Are you sure your partials exist at that path? 您确定您的零件存在于该路径中吗? Have you used express.static?
您是否使用过express.static?
Can help more with any error messages you get. 可以帮助您解决任何错误消息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.