【发布时间】:2015-06-18 11:25:59
【问题描述】:
HTML 内容,
<button data-href="helloworld">Show href Value</button>
js内容,
$("body").on('click', 'button', function(){
console.log($(this).attr("data-href"));
});
打印出来
helloworld
在控制台中。 我正在将上面的代码迁移到 angularjs,
<div ng-controller="hello">
<button data-href="helloworld">Show href Value</button>
</div>
var app = angular.module('app', []);
app.controller("hello", function(){
//someone help me with the services that are to be injected and
//and what logic goes here to print the data-href attribute value
})
有人可以帮我处理hello 控制器函数的参数和内容吗?
【问题讨论】:
标签: javascript angularjs