Angular: Empty Fiddle
http://angularjs.org/
by Ztyx
HTML
<script src="http://code.angularjs.org/angular-1.0.1.js"></script>
<div ng-controller="MyCtrl">
<my-directive jens-msg="My test msg" test-hello-msg="Hej"></my-directive>
<my-directive jens-msg="My test msg2"></my-directive>
</div>
JavaScript
var myApp = angular.module('myApp', []);
myApp.directive('myDirective', function () {
var counter = 0;
return {
restrict: 'E',
template: '<div>Text: {{uniqId}} {{msg}}</div>',
scope: {
msg: '@jensMsg',
testMsg: '@testHelloMsg'
},
replace: true,
link: function(scope, element, attrs) {
scope.uniqId = counter++;
console.log(attrs)
}
};
});
function MyCtrl($scope) {
}