I'm new to angularjs and I don't know if this is possible and if possible how to implement it. I want to create a custom directive with a controller that uses information passed to it through attributes. This is a non working example of what I want to implement:
The HTML should look like:
<div ng-app="test">
<custom-directive attr1="value1" attr2="value2"></custom-directive>
</div>
And the js:
var app = angular.module('test', [ ]);
app.directive("customDirective", function(){
return {
restrict: 'E',
scope: ???,
controller: function(){
console.log("print attributes value: " + attr1 + ", " + attr2 );
}
}
};
});
And the expect console output should be:
print attributes value: value1, value2
Any idea? Thanks!