嘿傢伙我需要得到該按鈕的數據值,當我點擊它。我想通過這種方式,但它不工作..如何獲得點擊屬性值?
var app = angular.module('myApp', []);
app.controller("myAppCtrl", function($scope, $attrs) {
$scope.events = {}
$scope.events.btnLoadMore = function() {
var panel = $attrs.emptywidget;
alert(panel);
}
});
HTML
<html ng-app="myApp">
<head>
<title></title>
</head>
<body ng-controller="myAppCtrl">
<button data-emptywidget="#panel2" ng-click="events.btnLoadMore()">Click</button>
</body>
</html>
謝謝安德魯的觀點,這是給我更好的解決方案! –