I am using stringify and json is getting formatted and in alert it is coming.But in actual link it is not displaying. When I checked in console error was coming as "duplicates are not allowed in ng-repeat for the key".
Can anyone tell how to allow duplicates in ng-repeat so that formatted json will be printed.
You can use unique filter while using ng-repeat . If you use track by $index then unique won't work.
You can consider using transclusion inside a custom directive, to achieve the behavior you are looking for without using ng-repeat.
Definition and Usage. The ng-repeat directive repeats a set of HTML, a given number of times. The set of HTML will be repeated once per item in a collection. The collection must be an array or an object. Note: Each instance of the repetition is given its own scope, which consist of the current item.
Note: The $index variable is used to get the Index of the Row created by ng-repeat directive. Each row of the HTML Table consists of a Button which has been assigned ng-click directive. The $index variable is passed as parameter to the GetRowIndex function.
Add 'track by $index' to the repeater.
https://docs.angularjs.org/error/ngRepeat/dupes
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With