锚标记助手在 MVC 6 和 Angular js 中不起作用

Anchor tag helper not working in MVC 6 AND Angular js

我有一个使用 MVC 6 和 的新 ASP.NET 5 项目。

我的网页数据绑定按预期工作,但是当我在我的项目中使用 MVC 6 锚 TagHelper 时,数据绑定没有按预期工作。

 <div class="browse-movie-wrap col-lg-2 col-md-2 col-sm-3 col-xs-6" ng-repeat="movie in movies | filter:{IsPublished:true}">

CSHTML:

   {{ movie.Id }}  @*is working*@

<a asp-controller="Movie" asp-action="MovieDetail" asp-route-movieId="{{ movie.Id }}" class="browse-movie-link">
    @*this does not work*@
</div>

生成HTML:

<div class="browse-movie-wrap col-lg-2 col-md-2 col-sm-3 col-xs-6 ng-binding ng-scope" ng-repeat="movie in movies | filter:{IsPublished:true}">

228 //id is binded

<a class="browse-movie-link" href="/Movie/MovieDetail?movieId=%7B%7B%20movie.Id%20%7D%7D">

//but not binded anchor tag helper its remains movieID

注:代码在同一页

我还在 MVC 存储库中打开了一个问题。你可以找到它 here.

这是你正在做的。

您正在向 ASP.NET 发送 代码。你看到问题了吗?你告诉 ASP.NET:

My movie ID is {{ movie.Id }}

因此 ASP.NET 将 {{ movie.Id }} 编码为您的 URL。

您在服务器端概念中使用客户端代码。