Creating Custom directives

The framework has bunch of built-in directives. We can create our own reusable components!

Register a new directive into our module
It's the same process that we use for the controller; however, the directives require the creation of something called Directive Definition Object that will be used to configure the directive's behavior:
parking.directive("directiveName", function() {
return {};
});
Creating a Alert using custom directive:-
Below is the code for alert. We need to transform this code into a reusable directive using the following directive configuration properties: template, templateUrl, replace, restrict, scope, and transclude:
snippet
<div class="alert">
<span class="alert-topic">
Something went wrong!
</span>
<span class="alert-description">
You must inform the plate and the color of the car!
</span>
</div>
Related Tutorial
Follow Us
https://www.facebook.com/Rookie-Nerd-638990322793530 https://twitter.com/RookieNerdTutor https://plus.google.com/b/117136517396468545840 #
Contents +