NG-CLICK opening modal only firing once in list


#1

I have an ion-item within ion-list using ng-repeat

<ion-item ng-if="children" ng-repeat="child in children" class="item item-button-right item-avatar">
            <button ng-click="editChild(child)" class="button button-positive">
                <i class="icon icon ion-edit"></i>
            </button>
        </ion-item>

When the controller is first loaded, the click event is firing and it hits my function in my controller and opens the modal.
All subsequent clicks give me this error:

TypeError: fn is not a function
at $parseFunctionCall (ionic.bundle.js:21045)
at ionic.bundle.js:53458
at Scope.$eval (ionic.bundle.js:23100)
at Scope.$apply (ionic.bundle.js:23199)
at HTMLButtonElement.<anonymous> (ionic.bundle.js:53457)
at HTMLButtonElement.eventHandler (ionic.bundle.js:11713)
at triggerMouseEvent (ionic.bundle.js:2863)
at tapClick (ionic.bundle.js:2852)
at HTMLDocument.tapMouseUp (ionic.bundle.js:2925)

Not sure if I am doing anything wrong, this is standard Angular stuff??


#2

Can you also add controller source code?


#3

Sorry for late reply, been away, this issue is still not resolved, let me know if you need the full controller code.

$ionicModal.fromTemplateUrl('templates/secure/add-edit-child.html', {
    scope: $scope,
    animation: 'slide-in-up'
}).then(function (modal) {
    $scope.modal = modal;
});

 $scope.editChild = function (child) {
    $scope.mode = 'edit';
    $scope.editChild = child;
    $scope.modal.show();
};