Ionic website

I’m building a website with ionic . I push data with navCtrl to another page and every thing is working as expected . I get the params form constructor . the problem is when I refresh this page with browser not from ionic app , I get error ‘undefined id for my collection in database’ that’s a result of no params any more . how could I solve this problem ? thanks in advance :slight_smile:

@Morad-Abdo How is your page? Can you post the ts file?

Are you using @IonicPage with deeplinks?

If so, and the page receive the id, when you refresh the page you lose the id, unless the id is defined in the page segment (when you reload in the browser, the whole code is refreshed so the page is not seen as opened by another with navParams, but as the first page without params).

Take a look at your url when you change pages, the new page has something in the url to identify the resource it refers to? (in your case, the id)

When the page is reload in the browser, the only data the browser you have is the url itself (other than cookies, localstorage and the like).

You can use the @IonicPage to define the id though (I’m assuming this is the problem, it will be easier to discover if you post the code).

Try something like:

@IonicPage({
    segment: 'my-page/:pageId'
})
@Component(...)
export class MyPage {...}

The above code is in the case that the field name in the navParams is pageId. If it’s another, just change it accordingly (remember to use : before the id field name).

More info:

a vote of thanks . I’ve already done that :slight_smile: . Hi , I’m a junior ionic developer . I’ve just finished from my first app << thank’s god for that >> . I do not Know how to generate the apk or publish in store . Could you help me , please ?