code: function (model) {
              if (!this.ngModel) {
                  return;
              }
              var index = this.selected.indexOf(model);
              if (index !== -1) {
                  this.selected.splice(index, 1);
                  if (this.multiple) {
                      this.ngModel.$setViewValue(this.selected);
                  } else {
                      this.ngModel.$setViewValue(undefined);
                  }
              }
  
          }
docs: Deselect the given model.
  Does nothing if the given model isn't selected.
  
  @param {*} model