Link to home
Start Free TrialLog in
Avatar of Camillia
CamilliaFlag for United States of America

asked on

How can I do this in Angular, instead of jQuery?

This works in jQuery but I wonder how I can do it in Angular.

1. I have this tag

  <a ng-click="cancel()"  data-bookmark={{bookmark.bookmarkkey }} id="bookmark"  onClick="bookmarkClick(this)" href=""> </a>

Open in new window


2. jQuery code

<script>
  function bookmarkClick(id)
   {
     var v = $(id).attr("data-bookmark"));

    var bookmarkURL = v.split('#')[0]; //***** example of id --> Home?id=3#content_123 

  window.location.href = bookmarkURL + "#";
  

  }

$(document).ready(...{

});

</script>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Camillia

ASKER

Thanks, Julian. Let me try.