2015-02-10 102 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