I currently have two arrays of objects made in my javascript. The first array named list1 has keys named show and number, a boolean and integer. The second array named list2 has a key named number that takes on an integer.
I currently have a button that will add a number from list1 to list2, and I want to disable it the number already exists in list2.
Here is the HTML only showing repeat (my controller is renamed to list)
HTML
<li ng-repeat="item in list.list1>
<a href="#"
class="btn btn-info btn-large"
ng-disabled=!"item.show"
ng-click="list.addItem(id, $index)">
Add
</a>
</li>
JS
this.addItem = function(id, index)
{
this.list1[index].show = false;
this.list2.push({number: id})
};
I'm not sure why my code isn't working and this isn't the first implementation I've tried. Would really appreciate some tips on how to do this correctly. Thanks!
Sorry about the bad initial code, sleepless night hasn't really helped me debug this.
listthe alias for your controller? And what ispmt?!in theng-disableattribute