DijkeMark
DijkeMark

Reputation: 1316

AngularJS - routing with parameter to same page as without parameter

I have an static index.php page that gets loaded when you enter the base url /. This uses the MainController. I want the MainController to also accept a parameter from the url.

So when I enter /someParameter, the someParameter value should be accessable in the MainController. But the page should still load the basic index.php file.

I use ngRoute, but that seem to require templates that I don't have/use. Is there anyway I can do this without resorting to templates or something?

I can't seem to get ngRoute work for this.

Upvotes: 0

Views: 101

Answers (1)

JC Ford
JC Ford

Reputation: 7066

Sounds like you don't need routing, you just want access to the query string.

You can just use $location to get the parameter from the query string. The answer to the question below gives an example.

Angularjs using $routeProvider without ng-view

Upvotes: 1

Related Questions