简体   繁体   中英

ng-click handler does not fire when clicking on a button

I added the data-ng-click attribute on my button pointing to the copy function. However, the function does not run when I click on the button.

a.html

<button class="btn" data-ng-click="copy()">start</button>

a.js

$scope.copy = function() {
   console.log("aaa");
};

Why don't I see "aaa" in the console?

我假设您的按钮位于标记中,通常ng-submit =“ function()”禁用data-ng-click事件。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM