2015-02-10 75 views
0
<td><a ng-click="setRoute('forum')" href="#/forums?id=<?php echo $f_id;?>"><?php echo $f_name;?></a></td> 


.when('/forums?id=:id', { 
templateUrl: function(urlattr){ 
return 'app/components/forums/forums' + urlattr.id + '.php'; 
     } 
    }); 

我在做什么错?Angularjs和PHP动态链接

我想要动态链接到?id =页面。

在此先感谢!

回答

1

AngularJS路径不适用于查询参数。您需要使用更多REST风格的方法。

<td><a href="/forums/<?php echo $f_id;?>"><?php echo $f_name;?></a></td> 


.when('/forums/:id', { 
templateUrl: function(urlattr){ 
return 'app/components/forums/forums' + urlattr.id + '.php'; 
     } 
    }); 
+0

这样想....谢谢反正! – 2015-02-10 13:18:12