Angular: Empty Fiddle
http://angularjs.org/
by dave ho
HTML
<script src="http://code.angularjs.org/angular-1.0.1.js"></script>
<div ng-controller="MyCtrl">
Hello, {{name}}!
</div>
<reporter page="passport" user="userID" param3="foo"></reporter>
JavaScript
var myApp = angular.module('myApp',[]);
function MyCtrl($scope) {
$scope.name = 'Dave-0';
}
myApp.directive('reporter', function() {
return {
restrict: 'E',
replace: true,
template: '<div></div>',
link: function(scope, element, attrs) {
console.log("%o", attrs);
// do whatever you want with the params/values
alert(attrs.page);
alert(attrs.user);
alert(attrs.param3);
}
}
});