T
T
Testtest1322014-09-27 12:19:22
JavaScript
Testtest132, 2014-09-27 12:19:22

How to work with html5mode and node.js correctly?

client-side:

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

$locationProvider.html5Mode( true );

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, just an empty new page is returned, loaded not by ajax. Those. templateUrl: "partials/page.html" doesn't work

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2014-09-27
@Testtest132

that is, you did not notice that you are using relative paths, and this path is changing? Replace with absolute and there will be no problem.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question