code: function (inst) {
              if (inst.isDirty()) {
                inst.save();
                ngModel.$setViewValue(elm.val());
                if (!scope.$$phase)
                  scope.$apply();
              }
            }
docs: Update model on button click