Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Neil 40 posts 205 karma points
    Apr 20, 2023 @ 13:55
    Neil
    0

    updating umb-button state

    I've got an element with an action that sets the state to busy, then updates the state again once a promise is completed (along with some other variables).

    But I'm finding an issue whereby the promise returns almost immediatly, updates all the variables, but the "busy" state remains - regardless of the fact the bound "state" variable is now "success"/"error". Eventually the busy event times out, and the variable watcher updates all the results to the values, but I want the busy state to end immediatly upon update.

    Has anyone else come across this, and knows what I'm doing wrong, before I just rip out the Umbraco UI elements and write my own. (I'm sure the umb/uui elements are supposed to speed up development, not slow it down)

    View:

    <umb-button type="button" button-style="primary" state="model.buttonState" action="model.onButtonClick()">Click me</umb-button>
    

    Controller

    $scope.model.buttonState = 'init';
    $scope.model.onButtonClick = () => {
      $scope.mode.buttonState = 'busy';
      promiseFunc().then(() => {
        $scope.model.buttonState = 'success';
      }, () => {
       $scope.model. buttonState = 'error';
      });
    };
    
  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies