这是我来自后端的json数据
menu:[{
"menuUrl":"#/project/{{typeofproject}}/create"
}]
$scope.typeofproject="science"
$scope.url=menu[0].menuUrl;
<a ng-href="{{url}}"></a>
我输出了这样的#/ project / {{typeofproject}} / create
相反,我需要#/ project / science / create
答案 0 :(得分:2)
$scope.url = $interpolate(menu[0].menuUrl)({typeofproject: "science"})