FAQ Database Discussion Community


Use ng-click to show the right article using ng-show and ng-repeat

angularjs,angularjs-ng-repeat,angularjs-ng-click,angularjs-ng-show
The following happens in the same controller. I have a page that shows a list of article titles. If the user clicks on an article title a popup will show the article in detail. The article titles are generated by a ng-repeat. <div class="adItem" ng-click="showArticle = tiki._id" ng-repeat="tiki in tikis...

Angular fire ng-click on row but not on href

html,angularjs,twitter-bootstrap,events,angularjs-ng-click
I've made a page with bootstrap, and i would like to have an action when the user clicks on the row. This is easy, I put ng-click on the div that is the row. However, inside the row elements I've a link, and I would like to avoid the firing...

ng-click on current tag

css,angularjs,background,angularjs-ng-click
I have general container which is full screen background and inside it i have small div with content. In general container i have ng-click which activated when i click on small div. How can i disable that? <div class="generalContainer" ng-click="onlyBackground()"> <div class="smallDiv">Content</div> </div> I have tried to add z-index on...

How to prevent a ng-click event on a div in a sub controller from triggering an ng-click in the root?

javascript,angularjs,angularjs-scope,angularjs-ng-click
http://plnkr.co/edit/gB7MtVOOHH0FBJYa6P8t?p=preview I have a parent child controller example above, in the child when a button is clicked I displays the div showPop and then will $emit an event upwards to the $rootScope. Now in the parent / $rootScope I "hear" that event then activate another function. That function in the...

angular filter with ng-click + input

angularjs,filter,angularjs-ng-repeat,angularjs-ng-click
how can I get a filter with ng-click out of an ul as second filter for an ngtable? <ul class="artGroups"> <li class="" ng-repeat="artGroup in artGroups"> <a href="#" ng-click="">{{artGroup.artGroupName}}</a> </li> </ul> Here's a plnkr: http://plnkr.co/edit/Amdx2BzEWQWVYmRAgTMw...

angular: calling a function with parameter using ng-click inside directive template

angularjs,angularjs-directive,angularjs-ng-click
new to angular here :) I have a custom directive that have an ng-click in it which calls a function I have defined in a controller (not the directive controller). This is the html view: <course-pass course-id="bla"/> This is the directive: scotchApp.directive("coursePass", function($compile) { return { restrict: "E", controller: 'dropdownCtrl',...

Disable ng-click from outside element on link inside

javascript,angularjs,angular-ui-router,angularjs-ng-click
I have a site using ui-router where I have a table and I have an ng-click on the cells, but have a link inside the cell. I need to disable the ng-click from the cell, when the link is clicked. <div ng-click="click()" style="background: #d3d3d3"> <a ui-sref="about">go to about page</a> </div>...

Angular js form submits when it shouldn't

javascript,angularjs,angularjs-ng-click,ng-submit
I have an AngularJS form which looks like this: <form ng-submit="vm.update(vm.model)"> .. fields <button ng-click="vm.addCluster()">Add</button> .. more fields <input type="submit" value="Save" /> </form> When I click submit it works as expected - update() method is called. When I click the button it calls addCluster() but after that the form gets...

ng-click change class to selected button

angularjs,angularjs-ng-click,ng-class
i want to change class btn-white to btn-primary for the selected Button $scope.SelectedCombination = function (combinationId) { $scope.selectedCombination =combinationId; }; html <button ng-repeat="combination in combinations" class="btn btn-white" ng-model="" value="{{combination.combinationId}}" ng-click="SelectedCombination(combination.combinationId)" type="button">{{combination.name}}</button> ...

ng-click doesn't open new windows

javascript,html,angularjs,angularjs-ng-click
I have a table in which the last column contains buttons that should open a new window but they don't. Here is my code: <table class="table table-hover" id="angular_table"> <thead> <tr> <th class="company">Nome azienda&nbsp;<a ng-click="sort_by('company')"><i class="icon-sort"></i></a></th> <th class="code">Codice&nbsp;<a ng-click="sort_by('code')"><i class="icon-sort"></i></a></th> <th class="projectName">Nome...

AngularJS - stop ng-click expression evaluation after $event.stopPropagation

javascript,angularjs,events,angularjs-ng-click
I'm struggling stoping ng-click from evaluating the rest of expression after event cancelation was called. I've made the following plnkr. If you click on "Click me" text, you'll see that the value is changing, although the clickMe function is calling all known methods (by me, at least) to stop the...

Angular.js change location ng-click

javascript,angularjs,angularjs-ng-click
I've read some other posts on the same topic but cannot get my own to work. Basically, I want the location of my app to change on a ng-click event. So I have html code that looks like this: <button class="button icon-left ion-plus-round button-block button-calm" ng-click="send({{foods.cal}})"> Add Calories </button> And...

ng-click / ng-class combination not working as expected with $index

angularjs,angularjs-ng-click,ng-class
For some reason my ng-click / ng-class combination is not working. On click the class 'hide' has to be added based on the equality of the productDisplay variable. <div ng-repeat="product in project.data track by $index"> <p ng-click="productDisplay = $index"><strong>{{product.name}}</strong></p> <div class="fileList" ng-class="{'hide': productDisplay !== $index}">{{$index}}</div> I can click on the...

How to display an image or pdf file on new tab in angular js?

javascript,asp.net-mvc,angularjs,angularjs-ng-click
Below is my page: Now when i click on Capture1.png i want to first display that image on new tab without any pop up as shown in my above picture. Same way when i click on sample.pdf i want to first display pdf on new tab. This is my html:...

Angular interpolate scope variable in ng-click

angularjs,angularjs-ng-click
How do I construct the name of a scope variable in ng-click. E.g the I have a form in ng-repeat where the name is generated dynamically. I am using x-editable plugin so name in this case will create a scope variable called {{box.key}}{{$index}} <div ng-repeat="course in box.value track by $index">...

ng-click is not working - AngularJs

javascript,angularjs,html5,angularjs-ng-click
I have checked all the solutions available here, but it didn't help me. I am trying to display a button from AngularJs to html, but ng-click is not working for <a> or <button> tags. I am working in Eclipse and it contains many built in modules. Please help me out....

Method display on the scope is not executed

angularjs,angularjs-scope,angularjs-ng-click,angularjs-ng-show
I have a set of directives that share a scope Update: The code is available as a plunk here http://plnkr.co/edit/JZ77bsZgGrw6N4K718Is?p=preview todo-item: app.directive("todoItem",function(DeleteTodo,$log){ var dirDefObj = { restrict:'E', templateUrl:'app/templates/todo.html', scope:{ todo:'=value' }, controller:function($scope){}, replace:true }; return dirDefObj; }); template: <div class="ui card"> <todo-formui ng-show="todo.editMode"></todo-formui> <todo-cardui ng-show="!todo.editMode"></todo-cardui>...

Function in AngularJS controller not being called

angularjs,angularjs-controller,angularjs-ng-click
I am trying to call a function from my AngularJS controller with the following code: Controller Code (function () { var hello = angular.module("helloApp", []); hello.controller("HelloCtrl", ["$http", "$scope", function($scope, $http) { console.log("in controller"); $scope.test = function() { console.log("in test function"); $http.get("/test").success(function(data) { console.log("success"); }) .error(function(data) { console.log("error"); }); }; }...

Toggle class between two buttons in Angular but restrict to prevent same button from changing class

javascript,angularjs,angularjs-ng-click,ng-class
Trying to create some very basic functionality which basically makes two buttons behave like radio buttons. Have two buttons that are used to show/hide different content based on what is shown. So it is working as expected except for it is changing on any click. So if I click the...

AngularJS - Filter view by month with ng-click

angularjs,date,filter,angularjs-ng-click
I would like to filter my view with a simple link. I have several objects which all contain a date. Eg. If I click March only data with "Startdate" March should be displayed. I searched the web but found nothing which worked for me. This is my json object and...

How I can delegate a click event in angular?

angularjs,delegates,angularjs-ng-click,angular-directive
How can delegate a click event on my board, what I do is I tell element to find element with the class open-preview And I can not do it like I do. Because the li is created dynamically in ruby loop. I do not know how I can delegate a...

Changing scope variable on ng-click without calling a function

javascript,angularjs,operators,angularjs-ng-click,angular-ng-if
How can I change a Scope Variable without calling a function from controller. I'm trying to show a div content when the editState variable equals to 1 but it's not working. HTML <body data-ng-controller="profileCtrl as pctrl"> <div data-ng-click="pctrl.editState === 1">Edit</div> <div data-ng-if="pctrl.editState === 1"> ..... </div> </body> JS(in profileCtrl controller)...

Using ng-click inside np-repeat

angularjs,angularjs-scope,angularjs-ng-repeat,model-binding,angularjs-ng-click
I'm trying to implement a shortlisting functionality in a case where I'm using ng-click inside ng-repeat. While the $index is being displayed correctly outside the ng-click, $index is only the index of the last object in the JSON array in all the cases where the html is generated using ng-repeat....

Angular ng-repeat $index

javascript,html,angularjs,angularjs-ng-repeat,angularjs-ng-click
I'm creating a list of items the user can click to go to the next picture. <ol class="indicators"> <li ng-repeat="img in pics" ng-click="slideTo($index)"></li> </ol> this code works but the problem is that it doesnt fill in the $index in the ngClick directive. This is the resulting html: <li ng-repeat="img in...

ng-click used inside ng-grid

angularjs,ng-grid,angularjs-ng-click
I'm hoping you can help me figure out how to merge my ng-click event into my code. I've been trying to figure it out all weekend. I found this ng-click event jsfiddle: http://jsfiddle.net/nisham/09k8f5s4/97/ that I want to use inside my project. I want users to be able to see the...

How to trigger ng-click inside ng-repeat angularJS

angularjs,angularjs-scope,angularjs-ng-repeat,angularjs-ng-click
ng-click does not work inside ng-repeat. I have read all the guides and similar questions, but nothing work in my code. If I click on the tag inside the ng-repeat nothing happen, but if I click on my button the function is called. html <div ng-repeat="sykdom in sykdommer" ng-model="sykdom.name" ng-click="test();">...

Change selected