*Thank you Sanders,*

*Here below is the remove method of the Promise.*

  public remove(index:number){
  if(this._logger)
    this._logger.log('Account deleted: ' + this._accounts[index].title);

  this._accounts.splice(index, 1);
  }
}



*and here below is the entire Promise base. Please have a look, advice
further.*

public getAll():Promise<Array<Account>>{
      return Promise.resolve(this._accounts);
    }

    private _nextId = 3;
    private _accountLimit = 3;
    public create(newAccount:Account){

      return new Promise((resolve,reject) => {
        if(this._accounts.length >= this._accountLimit)
          return reject("Maximum accounts limit reached.");

      newAccount.id = this._nextId++;
      if(this._logger)
        this._logger.log('Account created: ' + newAccount.title);
      this._accounts.push(newAccount);
      resolve(newAccount);
   });
}
  public remove(index:number){
  if(this._logger)
    this._logger.log('Account deleted: ' + this._accounts[index].title);

  this._accounts.splice(index, 1);
  }
}






On 10 June 2017 at 15:02, Sander Elias <[email protected]> wrote:

> Hi John,
>
> probably, your remove function doesn't return a promise.
>
> Regards
> Sander
>
> --
> You received this message because you are subscribed to the Google Groups
> "Angular and AngularJS discussion" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/angular.
> For more options, visit https://groups.google.com/d/optout.
>

ᐧ

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to