AngularJS - Directive Example
by JongMin Han
HTML
<body ng-app='app'>
<b>Custom Elements(Tag)</b>
<custom-directives></custom-directives>
</br>
<b>Custom Attributes</b>
<div custom-directives></div>
</body>
JavaScript
angular.module('app', [])
.directive('customDirectives', function() {
return {
restrict: 'EA', // E: Elements, A: Attribute
replace: true,
template: '<div>Name: {{customer.name}} </br> Address: {{customer.address}}</div>',
link: function($scope, $element, $attrs) {
$scope.customer = {
name: 'Embian',
address: '서울시 xx구 xx동'
};
},
};
});