0

Hello i am new to angularjs and make a demo of dropdown menu ,I want to hide it once any of menu selected,please help me how to do this?

html

  <span class="toolbar-button--quiet navigation-bar__line-height" style="padding: 0;">
        <i class="ion-android-more-vertical" style="font-size: 26px; margin: 0; padding: 0 12px;" dropdown-menu="ddMenuOptions" dropdown-model="ddMenuSelected" dropdown-disabled="dropdownsDisabled"></i>         
    </span>

js

  $scope.ddMenuOptions = [
    {
      text: 'Featured',
      code: 'F'        
    }, {
      text: 'Name (A-Z)',
      code: 'A'
    },{
      text: 'Rating',
      code: 'M'
    },{
      text: ' Most Popular',
      code: 'MP'
    }
  ];

  $scope.ddMenuSelected = {


  };

1 Answer 1

0

A fiddle would have been better. Nevertheless, you can achieve this by using a flag/variable. This variable gets updated whenever you select or dropdown is shown. Once you select an option, set the variable's value to false/true and then in the HTML tag use ng-show="yourVariable" .

    <span ng-show="yourVariable"></span>

Just make sure you update the value of this variable whenever you open the dropdown and select an option.

Sign up to request clarification or add additional context in comments.

1 Comment

thanks for fast answer dear.but my div is dynamically generating,So i really dont know how to hide it once its selected

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.