0

When clicking on the button below i pass the persons id through the URL but i also would like to pass a reference to the array being clicked ( in other words a index of which position it has ). How to i pass this variable to the next html page?

<div ng-repeat="x in person.test2">
    <div ng-show="{{ x }}.length <= 3">

        <p>{{ x }}</p>

        <a href="/andring/{{ person._id }}">
            <button type="button" class="btn btn-primary">Edit</button>
        </a>

    </div>
  </div>
Oscar
  • 221
  • 2
  • 7
  • 18

2 Answers2

0

You can pass variable by adding ? sign.


<a href="index.html?id=10"></a> This is a basic rule, if it helps, use it.
saifudeen ni
  • 145
  • 9
0

Assuming you are using angular, you can (should) use angular router to navigate between pages. To pass data from page to page, you can use angular service to save and read back the data. Or you can do something like this, Angular2 how can i pass a question mark and some words in my url

Imran
  • 1,732
  • 3
  • 21
  • 46