Questions tagged [angularjs-ng-click]

The `ngClick` directive allows you to specify custom behavior when element is clicked.

The ngClick directive allows you to specify custom behavior when element is clicked.

Usage

As attribute:

<ANY ng-click="{expression}">
   ...
</ANY>

As class:

<ANY class="ng-click: {expression};">
   ...
</ANY>

Parameters:

ngClick – {expression} – Expression to evaluate upon click. (Event object is available as $event)

References:

http://docs.angularjs.org/api/ng.directive:ngClick

1090 questions
451
votes
5 answers

AngularJS ng-click stopPropagation

I have a click Event on a table row and in this row there is also a delete Button with a click Event. When i click the delete button the click Event on the row is also fired. Here is my code.
michael_knight
  • 4,921
  • 3
  • 17
  • 10
399
votes
7 answers

Adding parameter to ng-click function inside ng-repeat doesn't seem to work

I have a simple loop with ng-repeat like this:
  • {{task.name}}

  • There is a function in the controller $scope.removeTask(taskID). As far as I know…
    Paweł Szymański
    • 7,562
    • 6
    • 22
    • 18
    245
    votes
    8 answers

    How/when to use ng-click to call a route?

    Suppose you are using routes: // bootstrap myApp.config(['$routeProvider', '$locationProvider', function ($routeProvider, $locationProvider) { $routeProvider.when('/home', { templateUrl: 'partials/home.html', controller:…
    112
    votes
    10 answers

    How to trigger ngClick programmatically

    I want to trigger ng-click of an element at runtime like: _ele.click(); OR _ele.trigger('click', function()); How can this be done?
    mulla.azzi
    • 2,676
    • 4
    • 18
    • 25
    98
    votes
    10 answers

    adding and removing classes in angularJs using ng-click

    I am trying to work how to add a class with ngClick. I have uploaded up my code onto plunker Click here. Looking at the angular documentation i can't figure out the exact way it should be done. Below is a snippet of my code. Can someone guide me in…
    NewKidOnTheBlock
    • 1,491
    • 3
    • 16
    • 32
    74
    votes
    4 answers

    Automatically pass $event with ng-click?

    I know that I can get access to the click event from ng-click if I pass in the $event object like so: