Yes, it is possible to run the ng-click function through the console in a few different ways:
var element = document.querySelector('[ng-click="myFunction()"]');
angular.element(element).triggerHandler('click');
var injector = angular.element(document.querySelector('[ng-app]')).injector();
var $rootScope = injector.get('$rootScope');
var $controller = injector.get('$controller');
var $scope = $rootScope.$new();
$scope.myFunction(); // call the function directly
var element = document.querySelector('[ng-click="myFunction()"]');
var $scope = angular.element(element).scope();
$scope.$apply(function() { $scope.myFunction(); });
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2023-06-17 10:20:30 +0000
Seen: 8 times
Last updated: Jun 17 '23
Does on_failure_callback run exclusively on the task level and not on the level of the entire DAG?
What is the process for using pnpm to build a single workspace only?
Why are commands unable to run on Windows PIP due to an invalid value for require-virtualenv?
Why does my game data always reset when I run tests in Roblox Studio?
What is the process to use Docker to deploy a Next.js application on HTTPS (SSL connection)?
How to incorporate Angular Universal into a pre-existing Angular 14 application?