No description, website, or topics provided.
Switch branches/tags
Nothing to show
Clone or download
Pull request Compare This branch is 1 commit ahead of learn-co-students:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

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 successMessage and errorMessage so we can use them in Angular via <success-message></success-message> and <error-message></error-message>.

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 and start learning to code for free.