I have some HTML table on the UI which is created dynamically. There is a condition in which when user will click on a button in a table row then that button will hide itself and some div element will be displayed.I have used ng-show and ng-hide property for that. But it is not working as desired.
Table :
Id Column1 Column2 Action
1 somevalue somevalue <Button>
2 somevalue somevalue <Button>
Html of Button Element :(where Id is table first column value)
<button ng-show="hidepenality' + Id + '" type="button" class="btn btn-primary btn-xs" ng-model="btnChangePenality" ng-click="ChangePenalityButton(' + Id + ')" >Change Penality</button>
Html of radio button div : (where Id is table first column value)
<div ng-hide="hidepenality'+Id+'"><label class="c-radio" data-ng-repeat="panalityType in penalityTypeList"><input type="radio" name="typepenality" data-ng-model="typepenality.Id" data-ng-value="{{panalityType.Id}}" /><span>{{panalityType.Type}}</span></label> </div>
Now, when I am clicking on first row button then logic should only hide first row button and only display first row radio div (which is by default hide). Below is my logic :
$scope.ChangePenalityButton = function (Id) {
var scope = $parse('hidepenality' + Id)
scope.assign($scope, false);
}
But when I am clicking on first row button then button is hiding for both rows, when it should just for first row as per the logic.
Please help!!!!