0

So in hmtl I have this:

accounts.length:{{accounts.length}}

I also have the loop that prints all the accounts.

The controller declares this:

$scope.accounts; //List of accounts

In html, for each account there is a remove button. When clicking on it this code in my controller is executed:

myService.deleteAccount(account.id).then((res) => {
    if(res && res.status === 200){
        $scope.accounts.splice(index, 1);
    }
  })

This app has been built with tabs (own coded tabs). One of the tabs contains the list with these accounts.

Now, this code works most of the times. It always goes through the service call to remove the account from backend. However, when I do the following steps, in the GUI I cannot see the removed account disappear:

I go inside tab for accounts
I create a new account (which pushes to the accounts array). I can see the new account in the list
I go to another tab
I come back to account tabs
I delete an account. But it doesnt disappear. And the length is the same as if it wasn't deleted. But in the controller
the "splice" occurs and I can see that the account has been removed. But not in GUI.

Any clue?

oderfla
  • 1,695
  • 4
  • 24
  • 49

0 Answers0