ChrisM ChrisM - 11 months ago 163
Javascript Question

Use ng-click with data-ng-href

I'm trying to have a button that brings a user to the product details but id also like the button to increment a counter through an ng-click function

<div class="row center-block save-button" >
<a data-ng-href="/savings/{{saving._id}}" >
<md-button aria-label="button" ng-click="upVoteHome(saving)" type="button" class="save-button-md">Save</md-button>

The ng-click here has no effect and never cllas the function.

How do I combine the two?



do this:

<div class="row center-block save-button" >
        <md-button aria-label="button" ng-click="upVoteHome(saving, {{saving._id}})" type="button" class="save-button-md">Save</md-button>

and then in the upVoteHome function incremment the counter and then redirect to the url that is passed.