angularjs - How to get URL parameters from a static URL address? -


i'm new angularjs.

i've created simple test angularjs app retrieves test data $resource , binds data web page (no ng-view directives). test url http://localhost/member. while good, i'm trying url parameters in controller can pass $resource provider.

for example, want query member of id 1234 - http://localhost/member/1234. how retrieve id parameter of 1234 in controller?

thanks help.

if use angular routing $routeprovider , ng-view, access $routeparams.

in case, don't use angular routing, suppose you're using html5 mode $location service. try: $location.path()

angular.module('app', []). config(function($locationprovider){     $locationprovider.html5mode(true); }) .controller("testctrl",function($scope,$location){     alert($location.path()); }); 

demo


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -