angularjs-ng-click

AngularJS: ngTouch 300ms Delay

瘦欲@ 提交于 2019-11-29 19:59:19
This Plunkr has 2 links. The one on the left side is using the ng-click directive with the on angular-touch module inserted. As said in the angular touch module description for ng-click, the ng-click link should not have a 300ms delay. But if you test it on mobile devices, this is still the case. So is plunkr preventing the correct functionality because its executed in an iFrame or something like that or is it required to insert Fastclick.js into the project for the directive to work correctly ? I don't get it, please help. Example: http://plnkr.co/NRRrmMFaIKg2zLu5C1Tg edit: the example in the

ng-click doesn't fire when added post load

こ雲淡風輕ζ 提交于 2019-11-29 09:54:19
I'm trying to do a variable replacement while also making it clickable with ngClick . I made a plunker demo (click the button and observe that the input box stays unchanged) Markup: <body ng-controller="Ctrl"> <input type="text" id="input" name="input" ng-model="myValue" test> <p translate="VARIABLE_REPLACEMENT" translate-values="{{ 'translationData' }}"></p> <p ng-bind-html="alink"></p> </body> Angular stuff: var translations = { VARIABLE_REPLACEMENT: 'Hi, {{name}}' }; var app = angular.module('myApp', ['pascalprecht.translate', 'ngSanitize']); app.config(['$translateProvider', function (

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

跟風遠走 提交于 2019-11-29 06:57:53
In my controller: $scope.homeAction = function() { console.log("HomeAction"); }; In my view: <button ng-click="homeAction()">call homeAction()</button> When clicking the button, the method gets executed as expected by Chrome and Firefox, but IE executes it twice. Any idea why? Here is a plunker that reproduces the issue: http://plnkr.co/edit/pedZKjIVGDAYfMl0ZphJ . Just add type="button" to your button and it should be fixed. Default behaviour is submit and apparently that messes with your code. <ion-view title="Home"> <ion-content padding="true"> <button type="button" ng-click="homeAction()"

AngularJS - accessing ng-click in custom directive

情到浓时终转凉″ 提交于 2019-11-29 05:50:33
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 function? My directive: app.directive('directiveScroll', function () { return { restrict: 'AE', replace: 'true', template: '<div class="scroll-btns">' + '<div class="arrow-left" ng-click="scrollLeft(sectionID)"></div>' + '<div class="arrow-right" ng-click="scrollRight(sectionID)"></div>' + '</div>', link: function(scope, elem, attrs) { $scope.scrollRight = function () { console.log("scrollRight clicked")

How do you toggle an active state ng-class in an ng-repeat item using ng-click?

人走茶凉 提交于 2019-11-29 02:11:57
<ul> <li data-ng-repeat="image in images" data-ng-click="toggle = !toggle" data-ng-init="toggle=false"> <img data-ng-class="{'active' : toggle}" src="" /> </li> </ul> CSS for 'active' class is from bootstrap. So toggling works, which is almost where I want it; I would like it similar to active states in navigation links, except in my example it's dealing with images so need to worry about url strings, etc. I tried emulating this example found here to no avail (I tried the same logic for images): ng-class to highlight active menu item based on ng-repeat. AngularJS If someone could point me in

Can angularjs ng-click process events during the capturing phase?

£可爱£侵袭症+ 提交于 2019-11-29 01:28:01
Is it possible to have angularjs ng-click process events during the capturing phase instead of bubbling phase? I want to aggregate data from each of the parent elements in order starting from the parent and ending with the element that was clicked on. Lets see the source code of ng-click at ngEventDirs.js#L50 As you can see the ng-click and all other event directives using .on() . So, the answer is No, it is not possible . If you really need it, you could write a custom directive for that. For example, modify the code of ng-click a bit: .directive('captureClick', function($parse) { return {

insert ng-click event into ng-grid

风格不统一 提交于 2019-11-28 23:51:49
i want to do something that i don't know if it is possible HTML <!DOCTYPE html> <html ng-app="myApp"> <head lang="en"> <meta charset="utf-8"> <title>Custom Plunker</title> <link rel="stylesheet" type="text/css" href="http://angular-ui.github.com/ng-grid/css/ng-grid.css" /> <link rel="stylesheet" type="text/css" href="style.css" /> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.2/angular.min.js"></script> <script type="text/javascript" src="http://angular-ui.github.com/ng-grid/lib/ng-grid

jQuery not working with ng-repeat results

柔情痞子 提交于 2019-11-28 20:48:23
I am using ng-repeat to build an accordion using jQuery and TB. For some reason, this is working perfectly when hardcoded but fails to trigger on click when inside of the ng-repeat directive. I was thinking that the issue is from jQuery not binding elements loaded in after the fact. So, I figured that instead of loading the script on page load, it would be better to load the function on .success when the data is returned. Unfortunately, I cannot figure out how to make this work. Test page : http://staging.converge.io/test-json Controller : function FetchCtrl($scope, $http, $templateCache) {

Disable ng-click on certain conditions of application for all types of element

本秂侑毒 提交于 2019-11-28 17:11:55
问题 In my application I've binded several elements with ng-click directive like below <a ng-click="DoSomething()"/> <button ng-click="DoSomethingElse()">xyz</button> <span ng-click="DoSomething()"></span> Now in my application in certain scenarios I want default behavior of ng-click to happen, but in certain scenarios I want to completely disable the callback function(DoSomething(), DoSomethingElse()..) to be called.. For checking this scenarios I've one scope variable say $scope.IsClickEnable =

AngularJS: ngTouch 300ms Delay

笑着哭i 提交于 2019-11-28 15:11:15
问题 This Plunkr has 2 links. The one on the left side is using the ng-click directive with the on angular-touch module inserted. As said in the angular touch module description for ng-click, the ng-click link should not have a 300ms delay. But if you test it on mobile devices, this is still the case. So is plunkr preventing the correct functionality because its executed in an iFrame or something like that or is it required to insert Fastclick.js into the project for the directive to work