2014-09-27 70 views
0

客戶端:使用AngularJS html5mode與express.js

when("/page/:id", { 
    templateUrl: "partials/note-tpl.html", 
    controller : "AppPageController" 
}); 

$locationProvider.html5Mode(true); 

HTML:

<a ng-href="/page/{{Page._id}}">{{Page.name}}</a> 

服務器端:

app.use("/page/:id", function(req, res) { 
res.send(req.params) 
}); 

結果我得到空頁或只是帶ID的對象。怎麼了? Angular不加載note-tpl.html模板

回答

0

可能是因爲express模板引擎與angular的衝突。

您使用的是什麼視圖引擎?

{{}}的使用可能是通過表達而不是角度來處理的。您可以更改服務器視圖引擎以使用其他關鍵字。

0

聽起來像您的服務器沒有迴應note-tpl.html。

您確定您的部分存在於該路徑嗎?你用過express.static嗎?

可以幫助更多您遇到的任何錯誤消息。