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

learn more… | top users | synonyms

-1
votes
0answers
14 views

ng-click is not working for the cloned elements in angularJs

Here i have used accordion and on click of each cloned element it should expand.but only the parent element and last child is expanding.others are not responding and it is not even hitting to the ...
0
votes
1answer
67 views

ng-click gives “href undefined ” error on a function call with a parameter

After seeing multiple issues around this, I'm still unable to figure out why the error occurred. Here is my code so far: app.js myApp.controller("myController", function($scope, $window) { $...
0
votes
2answers
35 views

How can I apply ng-style dynamically if ng-class is true?

.test{color:red;background:blue;} .test.selected { position:relative; left: 100px; padding:10px; background:green; } <div ng-style="myStyle" ng-class="{select: x.selected}" ng-click="select(x)" ...
6
votes
2answers
3k views

Angular ng-click issues on Safari with IOS 8.3

This is a weird issue, that is some what hard to generate and explore. While building a web-app using Angular, my boss found that all the buttons on the app that are using ng-click directive are not ...
0
votes
1answer
40 views

I can't navigate to state ui router from address bar

I have a problem navigating to a state from the address bar or when i refresh the current state. i have the following code: Controller: $scope.selectCategory = function(category) { $location....
3
votes
5answers
31k views

Adding class to an element on its click event

I am new to Angular Js. I need to add a class to an element on its click event. I tried the following code. But it is not working. <html> <head> <style> .active{color:...
0
votes
0answers
40 views

Can access response inside ng-click with ui route

I have a problem. Im confused because value from ng-model and ng-click can used inside templateUrl ui router. So, I have a template , example : thread.html. There are ng-click inside thread.html. So ...
0
votes
2answers
46 views

How can I change URL from $scope in AngularJS?

I have made access navigation with $scope and I used them based on click and I did. I can't set URL in variable accommodate. The correct URL is http://www.example.com/base/index or http://www.example....
14
votes
2answers
19k views

AngularJS - accessing ng-click in custom directive

I'm trying to get my head around directives, i can easily use the template function to throw out my HTML, however, if i have an ng-click within my template, how can i access it within the link ...
-1
votes
1answer
50 views

Switch Button After Clicked With AngularJS

When I click button "on" my API run xhr to "activate" my data. But when I click button "off" my API run XHR to "deactive" my data.isactive I got from data API(0 or 1). Therefore, I use _ ng-show ...
12
votes
6answers
19k views

AngularJS error: TypeError: v2.login is not a function

I would like to call the login function when I click the login button but keep getting the error message in the title. Can someone point out the error in my script? login.js code below: /*global ...
0
votes
2answers
34 views

how do you prevent someone from double clicking a <tr> ng-click in an angular binded html?

So basically, I have this line of code; <tr data-toggle="modal" data-backdrop="static" data-target=".bs-example-modal-lg-packageinfo" ng-click="retrievePromoData({!! $pPackages['iid']!!}, {!! $...
-1
votes
3answers
41 views

Method is on scope still not getting called from ng-click

Below is the HTML that I'm using <div ng-controller="profileEventsCtrl" > <div class="row mainNavbar" data-ng-show="hideVanityPlate"> <div id="navigatornavbarview" data-ui-view="...
0
votes
1answer
51 views

ng-click working without clicking

I have a search button with an <input> field. The button has ng-click="run()" which works immediately typing inside the input field. Isn't it suppose to work after the button is clicked? I am ...
1
vote
0answers
38 views

how to setup right link

i have a function that is sending users to different services. I need to upgrade it for another task too. $scope.toService = function(serviceId) { /*var nonContractExternal = { serviceId:...
0
votes
2answers
26 views

Angular: Convert parameter String inside ng-click

is it possible to convert String to int inside ng-click? I have this data $scope.cartList = [{ number: "1"}]; So in my view i just call number using ng-repeat( ng-repeat="cart in cartList"). I use ...
1
vote
1answer
51 views

AngularJS recursive template close by default all nodes and expand them with ng-click

is it possible with this example from Ben Foster to get all nodes closed by default (at the loading of the page) ? and to open each node with ng-click ? http://jsfiddle.net/benfosterdev/NP7P5/ I ...
1
vote
2answers
1k views

Angular-Foundation and ng-click not working on <a> tag

Spent the whole day trying to figure this simple issue but no luck. I added ng-click to < a > tag but it's not calling the function. If I put the ng-click on a button, it works. I've tried the ...
7
votes
4answers
11k views

How to validate a form when the submit button is outside of this form, with angularJs?

I have a form element created with AngularJS with a submit button within it and I would like to put this button outside of this form. How can I do that with Angular and have my form still validated? ...
0
votes
2answers
77 views

AngularJS - ng-click + ng-touch not working properly on mobile

I have both ng-click and ng-touch on a button used for search. On desktop the search and the functions called in ng-click work properly. On mobile on the other side the search button stops working ...
0
votes
4answers
52 views

Adding parameters to ng-click in Angular JS

My code is something like this HTML view <div ng-app="myApp" ng-controller="myCtrl"> <button ng-click="get_user_detail(Andrew)"> </button> <button ng-click="...
7
votes
4answers
7k views

How to allow ng-click when button is disabled in Angularjs

I have the following form: <form name="formuser" action='/signup' method='post' novalidate> <input type="text" name="firstname" ng-model="firstname" ng-class="{ 'has-error' : (formuser....
1
vote
2answers
36 views

Prevent execution of two directive expressions

I've got this html <nav ng-init="items = false"> <ul class="main-items"> <li><a ng-click="..."></a></li> <li><a ng-click="..."></...
4
votes
3answers
1k views

$scope's method called via ng-click: executed twice by IE

In my controller: $scope.homeAction = function() { console.log("HomeAction"); }; In my view: <button ng-click="homeAction()">call homeAction()</button> When clicking the button, the ...
1
vote
1answer
29 views

Ng-click not working dragula drag-drop elements

Using dragula plugin (Angular 1) link ng-click not working moved (drag and drop to another ul) on li element <ul dragula='"second-bag"'> <li ng-click="fun()">Item One </li> &...
67
votes
8answers
138k views

How to trigger ng-click [AngularJS] 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?
0
votes
0answers
42 views

Angular two forms, two ng-click, same function, only the first one runs

I have two forms on a page. The first adds an item to the database, and the second is prepopulated with the data and allows the user to modify the item. The first form allows the user to create and ...
4
votes
3answers
4k views

Angular ng-click giving Syntax Error: Token '{' invalid key at column 22 of the expression

Before I post my question, just want to let you know I searched enough and couldnt find the solution. This issue is perplexing me. I have following code. First ng-click correctly inserts the ID in ...
1
vote
2answers
32 views

Hide previous content on second click of the button of any loop inside ng repeat

I have a ng-show inside ng repeat. Whenever i click the comment button it shows the div tag contains comment box which shows previous comments of that list. The actual problem is when i click one ...
0
votes
2answers
70 views

ng-repeat ng-click showing only last value from an array

I am trying to show the details of each of my values from my data in a pop up window however, only last value from an array is shown three times instead of three different values. This is my html: ...
1
vote
1answer
26 views

Angular get CSV file in browser by calling URL

I have made a Java micro service to export a table from a database into a CSV file and get it in browser by following this: Downloading a CSV File in Browser by using Java It works well and I get the ...
1
vote
2answers
33 views

Ternary condition in ng-click angular js

In HTML I have a button and I am using ng-click event on it, like this: ng-click="!user.name : openModel('lg') ? ''" I am saying if user.name is not defined then call the function called openModel() ...
1
vote
1answer
26 views

AngularJS model update reverting back to original

http://plnkr.co/edit/3UMwSK6H5VL0pZujL7Qh?p=preview Click edit and then cancel. The text boxes do not go away. Click cancel again, they go away. Please tell me why this is happening. I am losing my ...
0
votes
1answer
64 views

Printing what is inside a modal

I have a modal where I want to print the full contents of it. I don't want anything else printed aside what is within the modal. Here I created the button within the modal: This should not be ...
1
vote
2answers
81 views

Angular ng-class via ng-click inside ng-repeat

Edit: The answers below haven't taken into account the +1 function that is also being applied. Still looking for how I can make both happen. I have an ng-click function that is called on a button ...
0
votes
1answer
20 views

How to use Angular ng-click function to only add 1

I have this function in my Angular controller but I only want the user to be able to add 1 heart, and if they click again, it would remove the heart. How can this be accomplished? $scope.activeClass =...
0
votes
0answers
32 views

Selenium + Python: simulate clicking on angular elements

I'd like to automatize downloading some csv reports from iTunes AppAnalytics, using Python with Selenium WebDriver. In normal way I'm clicking on the download icon and then I get my file, here's the ...
0
votes
1answer
54 views

Use directive or ng-click to change preview in AngularJS [closed]

So I'm very new to angularjs and have written a function in js that I would like to figure out how to convert to I guess a directive. I have an image library using ng-repeat to load a series of ...
3
votes
1answer
1k views

Triggering a click event from within an angularjs function causes an error

I'm getting the error [$rootScope:inprog] $apply already in progress whenever I trigger a click event on a hidden file upload input. HTML: <!-- button that calls function in controller --&...
3
votes
0answers
45 views

Understanding the working of ngClick and ngDblclick

I was trying to figure out how ngClick and ngDblclick work in angularjs. The problem is that even while clicking twice, instead of calling doubleclick function once. Angular calls click function twice ...
306
votes
4answers
162k views

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. <...
1
vote
3answers
53 views

Creating a button that shows a modal in AngularJS using UIBootstrap

On my html page (rollup.html), I have a button.. <li style="float: right;"> <button id="myBtn" ng-click="printDivModal('rollup-tab')">Modal Test</button> </li> and I want ...
1
vote
1answer
40 views

Bootstrap Modal: Content from html page does not show within the modal

I have a created a button when you click it a modal appears. Here is the code: <li style="float: right;"> <button id="myBtn" data-target="#myModal" ng-click="printDivModal('rollup-tab')"...
6
votes
3answers
31k views

ng-click event is not firing on button click?

i'm creating web application in Angularjs i write code in separate .js file for log in from database is is execute on page load but not triggering on button click, my .js code is: var adminModule =...
2
votes
2answers
78 views

angular - handle ng click, except when that click becomes a drag

The desired behavior is that a user can click on this object (so it has an ng-click) but if the click turns into a drag before mouseup, then the ng-click handler is not fired. Perhaps a way to detect,...
0
votes
1answer
78 views

How to handle ng- click() with argument in a Protractor

Code line: ng-click="my.Update(Profile)" Now how will I locate this element in protractor?
0
votes
1answer
49 views

Unable to inject items into a function using ng-repeat

<div class='basket__center_item' ng-repeat="item in baskeItems" > <img class='basket__center_foto' src="img/{{item.foto}}" /> <h4 class='basket__center_name' > {{item.name}}&...
0
votes
2answers
75 views

Toggle two classes with AngularJS / jqLite on click

I wan't to get a slideIn / slideOut animation by toggling the classes slideInRight and slideOutRight to a ul element. I've tried it in different ways but I it only works with one className. How ...
0
votes
3answers
6k views

Angularjs show and hide result based on radio button selection

I am trying to show and hide a value based on the radio button selection. I am doing this on ng-click of radio button. It is not working for me Here is the HTML and Angular js code **HTML Code:** &...
8
votes
1answer
89 views

Ionic triggers unwanted ng-click on right click and middle click

I am using Ionic in the latest Chrome Version and Chrome canary for some very ODD reason Right click causes ng-click to trigger. Code Pen demonstrating the issue any one can shed some light ?