Search code examples
angularjsangular-ui-routerui-sref

Exclusion click ui-sref


I'm working on a form using u-router in AngularJS. I created 5 tabs using the u-sref. I did run the next tab when you click "continue", I use state.go. Therefore, I would like to turn off the ability to click and move the form by the so called tabs ui-sref. How to disable the ability to click on a bookmark ui-sref ?

example:

<a ui-sref=".data" class="btn btn-primary">DATA</a>

Solution

  • You can add the CSS property pointer-events: none to your <a> tag. The link won't be clickable any more.

    I updated the Plunker you mentioned in your comment with the following changes:

    Add class no-click-link to CSS:

    .no-click-link {
      pointer-events: none;
    }
    

    Add this class to the <a> tags:

    <div id="status-buttons" class="text-center">
      <a class="no-click-link" ui-sref-active="active" ui-sref=".profile"><span>1</span> Profile</a>
      <a class="no-click-link" ui-sref-active="active" ui-sref=".interests"><span>2</span> Interests</a>
      <a class="no-click-link" ui-sref-active="active" ui-sref=".payment"><span>3</span> Payment</a>
     </div>