0

I'm a beginner using the ionic framework.

I'm trying to use stateParams with a state but I don't want it to be exposed in the URL.

I could use stateParams when it's added to the URL (url/:param1) but when I tried to declare it under 'params' as mentioned here [ How to send and retrieve parameters using $state.go toParams and $stateParams? ] and here [ AngularJS: Pass an object into a state using ui-router ], I get the following error:

Uncaught Error: [$injector:modulerr] Failed to instantiate module surveyApp due to: TypeError: undefined is not a function at getArrayMode (http//localhost:8100/lib/ionic/js/ionic.bundle.js:38251:39) at new Param (http//localhost:8100/lib/ionic/js/ionic.bundle.js:38224:21) at http//localhost:8100/lib/ionic/js/ionic.bundle.js:38857:39 at forEach (http//localhost:8100/lib/ionic/js/ionic.bundle.js:8147:20) at Object.stateBuilder.ownParams (http//localhost:8100/lib/ionic/js/ionic.bundle.js:38856:7) at registerState (http//localhost:8100/lib/ionic/js/ionic.bundle.js:38975:72) at $StateProvider.state (http//localhost:8100/lib/ionic/js/ionic.bundle.js:39460:5) at $StateProvider.IonicModule.factory.config.$stateProvider.state (http//localhost:8100/lib/ionic/js/ionic.bundle.js:45621:31) at http//localhost:8100/js/app.js:88:3 at Object.invoke (http//localhost:8100/lib/ionic/js/ionic.bundle.js:11994:17) http//errors.angularjs.org/1.3.6/$injector/modulerr?p0=surveyApp&p1=TypeEr…3A%2F%2Flocalhost%3A8100%2Flib%2Fionic%2Fjs%2Fionic.bundle.js%3A11994%3A17)

here's a snippet of my code:

.state('tab.mytab', {
    url: '/mytab/:name',
    params: ['item'],
    views: {
        'tab-mytab': {
            templateUrl: 'templates/mytab/item.html',
            controller: 'MyTabCtrl'
        }
    }
})

any suggestions?

1 Answer 1

1

The array syntax for params that you are using is old and no longer supported since 0.2.12 I believe

You can use

params: { item: null}

Object as params rather than array. Docs

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.