FAQ Database Discussion Community


Click event on glypicon

angularjs,twitter-bootstrap-3,angularjs-ng-click
How do I add a ng-click event to a bootstrap glyphicon in a textbox? The event doesn't get fired... <body ng-app ng-init="mymodel='THIS IS MY MODEL'"> <h3>How to clear the model on remove icon click?</h3> <div class="container"> <div class="form-group has-feedback" > <input type="text" class="form-control" ng-model="mymodel"/> <i class="glyphicon glyphicon-remove form-control-feedback" ng-show="mymodel" ng-click="mymodel...

Angular: Use ng-click to auto fill/change data stored inside ng-grid

javascript,angularjs,ng-grid,angularjs-ng-click
I am new to angular. I have a simple page with a ng-grid that displays days and times. The idea is a driver is on the page and can click for each time slot whether his is available at the time to volunteer driving (Y, or N). Currently you can...

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...

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)...

Switching between tabs in modal in angular

angularjs,twitter-bootstrap,angularjs-scope,bootstrap-modal,angularjs-ng-click
I have a login and a signup form that opens in a modal. At the top I have two tabs switching between login and signup. see picture Switching between the tabs works fine. However, I want the user to be able to choose login as well as signup on my...

Ng-click - does the order matter when calling multiple methods?

javascript,angularjs,angularjs-ng-click
When calling multiple methods with ng-click, as in ng-click="select(); highlight()" do they get executed in order, i.e. first select() and then highlight()?...

ng-click value change + $scope.watch bind not working properly

javascript,angularjs,angularjs-scope,angularjs-ng-click,angularjs-watch
I have a scope variable '$scope.searchType' which is equal to 'createdAt' by default. In my HTML I have options that change the scope variable value: <ul class="dropdown-menu" role="menu"> <li><a ng-click="searchType = 'Anything'">Anything</a></li> <li><a ng-click="searchType = 'Payment'">Payment</a></li> <li><a ng-click="searchType = 'Total'">Total</a></li> <li><a ng-click="searchType = 'Tax'">Tax</a></li> <li><a...

append a html include ng-click in angularjs

angularjs,angularjs-ng-click
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...

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...

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>...

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...

AngularJs - Send data in ng-click to validate email

angularjs,angularjs-ng-click
I'm trying to check if the inserted email is in a valid format so I can choose what to do next. I'm trying to achieve this by sending myForm.$valid value inside the function that runs when the user hits the button to submit the email. Here is how I'm trying...

Can't get two different buttons to call two different functions with ng-click

angularjs,ionic,angularjs-ng-click
<div class="card"> <label class="item item-input"> <span class="input-label">Completed</span> <div class="button-bar"> <button class="button" ng-click="setActive('Yes')" ng-class="{'button-positive': isActive('Yes')}">Yes</button> <button class="button" ng-click="setActive('No')" ng-class="{'button-positive': isActive('No')}">No</button> </div> </label> </div> .controller('CompleteWorkOrderController', function($scope, $http) { $scope.active = 'No';...

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...

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...

With angularjs, how can I trigger a click, or is there a better way?

angularjs,angularjs-ng-click
I'm creating a form wizard with AngularJS. Think of each fieldset like so: <div ng-controller="MyController as fs"> <fieldset> ... <button ng-click="fs.StepForward($event)">Next</button> </fieldset> <fieldset> ... <button ng-click="fs.StepBackward($event)">Previous</button> <button ng-click="fs.StepForward($event)">Next</button> </fieldset> </div> What I've done is, in my controller found the current fieldset and the next fieldset like so: app.controller("MyController",...

How to print (on ng-click) an item of a ng-repeat outside the loop?

angularjs,angularjs-ng-click
I have a simple array of objects {name,age} (see my jsfiddle). I use an ng-repeat to print all the names and I would like to print, outside the ng-repeat loop, the age of the name on which I click. <body ng-app="myapp"> <div ng-controller="MyController" > <ul> <li ng-repeat="friend in myData.friends" ng-click="myData.doClick($index)">{{friend.name}}</li>...

How to call ng-repeat sort by predicate code from Controller?

javascript,angularjs,angularjs-ng-repeat,angularjs-ng-click
I have 2 directives, 1 controls the view for a list of tags and contains a couple of sort buttons and the other a popover menu with the same options: Markup for tagPanel: <header> <ul> <li ng-class="{'active':vol}" ng-click="vol = true; predicate = 'week_quantity'; reverse=!reverse">Vol</li> <li ng-class="{'active':!vol}" ng-click="vol = false; predicate...

ng-click swap out button

angularjs,angularjs-ng-click
When a user clicks on "Save Changes" I'm wanting to change the inner copy to "Confirm Changes" and then once they confirm the submit button works as per. I'm unsure of how to achieve this using angular. Here is my code so far: <div class="col-xs-12"> <p> <button type="submit" class="vfnz-submit">Save changes</button>...

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...

How to fix this ng-class toggle comparison?

javascript,angularjs,angularjs-ng-repeat,angularjs-ng-click,angularjs-ng-class
http://plnkr.co/edit/7v63GXSIDon1QKm1GXCE?p=preview I have an array which stores the name of each button that is clicked. Once clicked the object is placed into array, I use ng-class to check if the name of the object in the array is the same as the model used to create the button. Then if...

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>...

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...

Angularjs - ng-click function vs directive

javascript,angularjs,angularjs-directive,angularjs-ng-click
I can't decide which method to use in following case. I'm trying to alert when clicking on buttons. I can do this using 2 methods. Which is the best practice and please tell me why? Method 1 <div ng-app="app"> <button alert>directive</button> </div> var app = angular.module('app', ['ngRoute']); app .directive('alert', function(){...

How to close out all popovers on body click in Angular?

javascript,angularjs,angularjs-scope,angularjs-ng-click
http://plnkr.co/edit/hqXGl47EJ0wVaEgoXk3X?p=preview I'm trying to find the best way to accomplish this. Basically there are several popovers we have in our app, for fuzzy search, additional options, help tips etc etc. When any of them are open, they need to be closeable if the user clicks anywhere else outside of it,...

Change selected