Create a custom Directive structure
- Write a Directive and definition Object
Now that we've got the know-how on how to create very basic directives, let's create some.
We're going to have a success directive and an error directive. These should have templates inside them that have a message for when something succeeds, and when something fails. This means we can use the same language everywhere in our app just by referencing these two directives.
They should be named
errorMessage so we can use them in Angular via
Our success message directive should read "Success - it worked!". Our error message directive should read "Oh no - something went wrong!".
View Create A Directive Lab on Learn.co and start learning to code for free.