Could not resolve from state

Hi guys.

I’m trying to pass parameters between states in my app and I am receiving the following error:

Error: Could not resolve ‘previewMoment/:file:///storage/emulated/0/Android/data/com.ionicframework.starter/cache/modified.jpg?1400606556769/:undefined/:test’ from state ‘tabs.capture’

Here is a snippet of the code below, can anyone see anything immediately obvious?

.state('previewMoment', {
  url: "/previewMoment/:momentImage/:momentAudio/:momentTitle",
  templateUrl: "templates/previewMoment.html",
  controller: 'previewMomentCtlr' })

$scope.btnPreviewMoment = function(){
$state.go('previewMoment/:' + $scope.captureDetails.imageURI + '/:' + $scope.captureDetails.audioURI + '/:' + $scope.captureDetails.momentTitle);}

.controller('previewMomentCtlr', function ($scope, $stateParams) {
$scope.preview = {};
$scope.preview.title = $stateParams.momentTitle;
$scope.preview.imageURI = $stateParams.momentImage;
$scope.preview.audioURI = $stateParams.momentAudio;})

Basically on tabs.capture I have a button, when I press the button I want to move to state previewMoment and I want to pass 3 parameters from the tabs.capture scope to the previewMoment state.

From the reading I’ve done my code seems correct, but clearly I am missing something.

I’d greatly appreciate any advice :smile:
Thanks a million!

(just edited to add pre-formatted code blocks)

Hello! I can see some problems with your code:

  1. The resolved url is:


momentImage has slashes in it! Be careful with this.You’re effectively introducing more capture groups in the url for the same parameter.

$state.go takes as a parameter the absolute state name or relative state path, not an url (in your case the state name would be previewMoment). See:$state

What you need to use is: $location.url('previewMoment/param1/param2/param3'). You don’t have to put : in front of every url param.

  1. If you need to pass a file path (with slashes) in momentImage, you’ll need to use query params. See

Hope it helps!


Thanks so much for those insights, really appreciate the time you took to lay it out in an easy to understand way!

I’ll have a look at implementing your suggestions!

1 Like

Thanks that saved my day :slight_smile: