angularjs-ng-click

AngularJS: ng-click on img? Manipulating images (kind of gallery-like) with jQuery?

余生长醉 提交于 2019-12-03 10:32:16
Should ng-click work with img tag ? <img ng-src="img" ng-click="openNewWindow(url)/> myFunction is defined in controller and is $scope available … Nothing gets called; any ideas? (I would like to open a new tab/window when image is clicked, but I don't even get into my function) Thanks for any info EDIT I probably rushed myself when first asking this question. I know now why it doesn't work in my case: I am manipulating images with jQuery for some kind a 'gallery' effect … (if anyone has an idea how to do that in AngularJS please bring it on). This is the html I am talking about: <div class=

How to open up an Ionic Modal upon click?

狂风中的少年 提交于 2019-12-03 07:04:41
I am new to Ionic and AugularJS and I am having a problem opening up a modal box upon click on a checkbox/radio button on the third option for hashtag search in the settings page. I have included an ng-controller and ng-click to take action. I looked in the debugger and it displayed an error: GET http://localhost:8100/hashtag-modal [HTTP/1.1 404 Not Found 1ms] I know that 404 Not Found means it didn't find the templateUrl but every nav page I have is in the index.html and they work fine except hashtag-modal.html in the app.js file. Why isn't it working and how do I resolve this issue? app.js /

ng-click not working with ng-if

不羁的心 提交于 2019-12-03 06:20:47
Why does the second button not work, when ng-if is used? I want to realize a button that is present only when the model value is set / not ""/ not null. Template: <input type="text" ng-model="blub"/> <br/> <button ng-click="blub = 'xxxx'">X</button> <br/> <button ng-click="blub = 'yyyy'" ng-if="blub.length">Y</button> Controller: angular.module('test', []) .controller('Main', function ($scope) { // nothing to do here }); To play around: JSFiddle Use ng-show Instead of ng-if . That should work. Fiddle It doesn't work because ng-if is creating a new scope and interpreting your blub = 'yyyy' as

How to use ng-click with multiple expressions? [duplicate]

烈酒焚心 提交于 2019-12-03 06:13:23
问题 This question already has answers here : How to add many functions in ONE ng-click? (6 answers) Closed 5 years ago . I want to use ng-click to perform multiple expressions. I want to both set a value on a model, and call a method from the $scope , like this: <a ng-click="navigation.book = book && bookSvc.showBook(book)" href="#{{book.id}}">{{book.title}}</a> Where I have && separating the two different expressions I want to perform. I know I could just add a method that does both things in

AngularJS reusable modal bootstrap directive

ぃ、小莉子 提交于 2019-12-03 04:36:54
问题 I'm new with AngularJS. I'm trying to implement a reusable modal Bootstrap. This is the index.html: <div ng-controller="mymodalcontroller"> <modal lolo="modal1" modal-body='body' modal-footer='footer' modal-header='header' data-ng-click="myRightButton()"></modal> <a href="#{{modal1}}" role="button" class="btn btn-success" data-toggle="modal">Launch Demo Modal</a> </div> This is the module, controller and directive: var myModal = angular.module('myModal', []); myModal.controller(

append a html include ng-click in angularjs

守給你的承諾、 提交于 2019-12-03 02:58:30
i have this code in mycontroller i will add this html() to my html, all it right just ng-click dos not work ! have you an ideas why ng-click dos not work var html='<div ng-click="selectedValue('+Value+')">Value</div>' ; $('#myDiv').html(html); $scope.selectedValue = function(value){ $scope.val =value; }; i have to slect the value displayed in the div by using ng-click function selectedValue Mukund Kumar use this code: See pluker Controller: var html='<div ng-click="selectedValue(value)">Value</div>', el = document.getElementById('myID'); $scope.value='mk'; angular.element(el).append( $compile

Prevent swipe from triggering ng-click handler

巧了我就是萌 提交于 2019-12-03 02:24:46
I'm working on implementing an iOS-like swipe-to-delete gesture on HTML table rows. For example, a leftwards swipe on Site11 will turn it from a standard row: into a delete-able row: I have this functionality working with the ng-swipe-left directive. However, I also have a ng-click directive on each row that navigates to a different view of the application. Currently, both events are triggered when I perform a swipe on a row, except when the swipe ends on the "Site11" text itself, as opposed to anywhere else within the row. For example, this gesture will trigger both the ng-click and the ng

Adding class to an element on its click event

喜欢而已 提交于 2019-12-03 01:41:23
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:red;} </style> <script src="js/lib/jquery.min.js"></script> <script src="js/lib/angular.min.js"></script> </head> <body ng-app="MyApp" ng-controller="MyController"> <div ng-repeat="data in datas"> <p ng-click='selectMe()'>{{data.name}}</p> </div> <script> var app = angular.module('MyApp',[]); app.controller('MyController',function($scope){ $scope.datas = [{name:"first"},{name:"second"}]; $scope.selectMe = function (){ $(this)

AngularJS - multiple ng-click - event bubbling

耗尽温柔 提交于 2019-12-03 00:57:13
In the following example: <li ng-repeat="item in items" ng-click="showItem(item)"> <h3>{{item.title}}</h3> <button ng-click="remove(item)">Remove</button> </li> When I click on the button showItem() also is invoked due to event bubbling. I know that I can use $event to watch for $event.currentTarget and do $event.stopPropagation() etc. but this is very ugly. Btw. I don't want to stop propagation on the button (In my case the button is a twitter bootstrap dopdown/button - this is just an example) How do I stop showItem() from beeing called when I click on the remove button? EDIT The ugly fix

How to allow 'Open in a new tab' when using ng-click?

谁都会走 提交于 2019-12-02 22:11:40
I have a table on HTML and each row leads to a different page, with more details about that row. But as I am using angularjs, with ng-click I can't right click this row and select 'open in a new tab'. Is there any way to solve it? Thanks in advance! If possible you should convert your element to an anchor element. <a ng-href="{{ your dynamic url }}" ng-click="your function">Your link text</a> The browser will interpret the element as a link, and will therefor give you the correct dropdown. Note that you also have to have the correct href value to open in a new tab. EDIT: I would recommend this