Search Posts

Category: angularjs-ng-click

Button working only on second click (any 2 clicks each)

I have a simple, but annoying problem: In my fragment, I have a button which should call function. but I have to click the button twice (any 2 clicks it works, but when i debug it any time I click the button the function is running , but only the second time I can see my output on the screen). HTML: <div class=”container”> <button ng-click=”$ctrl.getObject()” > GET MOVIES </button> </div> component: ‘use strict’; const appModule […]

md-menu won’t open with ng-click

I’m trying to create a md-menu inside of a md-toolbar and have it open on click. My code for the button that would open the dropdown menu is below: <md-button aria-label=”Open menu” class=”md-icon-button” ng-show=”(data.isAdmin || getUIActions(‘context’).length > 0) && options.omitHeaderOptions != ‘true'” ng-click=”$mdMenu.open()”> <md-icon md-menu-origin id=”adminMenu”>menu</md-icon> </md-button> I have two questions — 1) In a previous iteration of this code, I had ng-if on my md-button. With ng-if, the dropdown menu was always open and […]

ng-click not working, dont know why

Hey, I’ve been trying to solve this problem and searching on the web has got no results. For some extrange reason ng-click has stopped working on my project. This is my routes $stateProvider .state(‘index’, { url: ‘/’, templateUrl: ‘templates/dashboard.html’ }) .state(‘tables’, { url: ‘/tables’, templateUrl: ‘templates/tables.html’, controller: ‘MasterCtrl’ }); The controller function angular.module(‘module’) .controller(‘MasterCtrl’, [‘$scope’, ‘$cookieStore’, MasterCtrl]); function MasterCtrl($scope, $cookieStore) { $scope.doSomething = function(){ alert(“HEYYYY”); }; } And the html button < button ng-click=”doSomething “>clickMe!< […]

Ng-click not working but other ng-click working

I want to ask you some help in AngularJS. ng-click is not working on my code. here is the html: <div layout=”row” layout-align=”center center” ng-controller=”viewClasslistCtrl”> <div layout=”row” layout-wrap style=”padding-bottom: 32px;” ng-cloak> <span class=”deleteStud” ng-click=”deleteBtn(skey)”><img src=”assets/redclose.png”></span> </div> <md-button class=”btn rp-btn” ng-click=”test()” style=”width: 150px;”> Save </md-button> </div> here is the script: angular.module(“myApp”).controller(‘viewClasslistCtrl’, function ($scope, $http, $rootScope, $sce, selectedItem, assignmentModel, classModel, $timeout, $mdSidenav, $state, $mdDialog, $mdMedia, $log, $mdToast, studentListModel, courseModel, util) { $scope.test = function () { alert(“test”); […]

ng-click on img not working inside ng-repeat

In my view I have a list of icons that when clicked, should call a function from the controller. View <div ng-controller=”EditorController” class=”main-div”> <aside> <div ng-repeat=”icon in EditorIcons”> <img ng-click=”changeme()” data-ng-src=”{{icon.source}}” alt=”{{icon.name}}”/> </div> </aside> </div> Controller app.controller(‘EditorController’, function($scope) { $scope.EditorIcons = [ … ]; $scope.changeme = function() { console.log(“changing”); } } I’ve seen this question asked before, yet I still wasn’t able to find out the problem here. What am I doing wrong? UPDATE I’ve […]

AngularJS Select Tab from Button Click

Using the AngularJS tabs directive, is there a way to select a tab from a button. Effectively what I would like to do is click the button ‘Select Tab 3’ and the third tab will be selected. <md-button id=”button” class=”md-raised”>Select Tab Three</md-button> <div ng-cloak> <md-content> <md-tabs md-dynamic-height md-border-bottom> <md-tab label=”one”> <md-content class=”md-padding”> <h1 class=”md-display-2″>Tab One</h1> </md-content> </md-tab> <md-tab label=”two”> <md-content class=”md-padding”> <h1 class=”md-display-2″>Tab Two</h1> </md-tab> <md-tab label=”three” id=”three”> <md-content class=”md-padding”> <h1 class=”md-display-2″>Tab Three</h1> </md-content> </md-tab> […]

ng-click not working while calling a function on a ‘ul’ in angularJS

I’m creating a navigation menu using angularJS. My ng-click with the function “sayHello()” inside the ul or li are not working. However, all the other ng-click are working fine. ALso, if I just remove ‘obj.showChildMenu = !obj.showChildMenu’ from my first ng-click in the ul and just include ‘sayHello’ there, it is not working. But the one which shows = ‘obj.showChildMenu = !obj.showChildMenu’ seems to work fine. I’ve only attached the sample code here. The controller […]

AngularJS – ui-routing with ng-click not working properly

I’m using ui-router for creating some routes and I’m getting this very weird thing happening. I have this route config .state(‘chapter_route’, { url: ‘/book/:chap’, templateUrl: “views/chapter.html”, params: { chap: null} }) So when I clink on: <a ui-sref=”chapter_route({ chap: getChapter.title})”>CHAPTER:</a> It redirects me, as I wanted, to this following ui-view: <div class=”panel panel-default”> <div class=”panel-body”> <p>{{getChapter.title}}</p> {{getChapter.content}} </div> </div> …… …… <div class=”panel panel-default” data-ng-repeat=”cha in allChapters”> <div class=”panel-body”> <a ui-sref=”chapter_route({ chap: cha.title})” ng-click=”changeChapter(chap)”>{{cha.title}}</a> {{cha.content […]

Next Page »