I want to pass a value (0 or 1) to another page so i can make an ng if to return a different button. Any help? do i need to pass a parameter from .ts file?

first page.html

<button ion-tem (click)="goUsers()" *ngIf="editors.length == 0" value="0"> <ion-label>
            Add editors
          </ion-label> </button> <button ion-tem (click)="goUsers()" *ngIf="editors.length > 0" value="1"> <ion-label>
            Add more editors
          </ion-label> </button>

second page.html

<button ion-button item-end clear *ngIf="value === '0'"> (click)="addEditor(item)">
                Add as Editor
            </button> <button ion-button item-end clear *ngIf="value ==='1'"> (click)="deleteEditor(item)">
                Already an Editor

Recommended Answers

All 3 Replies

It was not the same thing. Then, i wanted to know how to send data e.g. the id from one page to another to show arrays or objects based on that id. Now i want to check if the id is there and to return different things if not. I dont know how to check if the id is there or not. I can't express it better sorry

Here's a thing. Over time web browsers have built up barriers to keep web page data private to that page and the server. So when you cross to another browser page I see a basic design problem as in "I don't expect this to work without a server holding that information."

That is, any data you need would go back to the web server then the new page would use pull data from your web server.

My answer is "Design the system to put and pull data from your web server. Don't count on being to access what's on a web page when you change pages or use another web browser tab." I'm not going to get into logins, session cookies etc.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.