jACK
jACK

Reputation: 159

Angularjs & php dynamic links

<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';
        }  
    });

What am I doing wrong?

I want to have a dynamic link to ?id= pages.

Thanks in advance!

Upvotes: 0

Views: 47

Answers (1)

thedoctor
thedoctor

Reputation: 1508

AngularJS routes don't work with query parameters. You need to use a more RESTful approach.

<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';
        }  
    });

Upvotes: 1

Related Questions