Question: I have this crud URL format:

> 
> domain.com/config/someconfig/edit/2
> 
> 
> 

Where I open the form ready to be prepped with the contents from record of id 2.

**How**, can I just get the 2 from the URI?

The easiest way possible would be something like:

```
if($location._uriseg(4) && typeof $location._uriseg(4) === 'number') then...

```

Is angular.js missing something like this?

Answer: 
is this an angular route set up via $routeProvider.when? if so, you can use $routeParams to grab the value. something like:

```
$routeProvider.when('/thing/:thingId', {
    templateUrl: 'thing.html',
    controller: ThingCntl
});

```

then in your controller, you can used $routeParams.thingId to access the value
My version the codeigniter way..

```
angular.module('myApp.Filters', [])
.filter('uri', function($location) {
    return {
        segment: function(segment) {
            var data = $location.path().split("/");
            if(data[segment-1]) { return data[segment-1]; }
            return false;
        },
        total_segments: function() {
            var data = $location.path().split("/");
            var i = 0;
            angular.forEach(data, function(value){
            if(value.length) { i++; }
            });
            return i;
        }
    };
});

//GET URI SEGMENT
$filter('uri').segment(0)
//GET SEGMENT LENGTH
$filter('uri').total_segments()

```