Become a member
to unlock all features

Level Up!

Access all courses & lessons on egghead today and lock-in your price for life.


    Directive Definition Object (DDO)

    John LindquistJohn Lindquist

    Directive Definition Objects are used to configure AngularJS directives. Be sure to check out our Directive Definition Object Cheat Sheet.



    Become a Member to view code

    You must be a Member to view code

    Access all courses and lessons, track your progress, gain confidence and expertise.

    Become a Member
    and unlock code for this lesson




    Man 1: This function that we just set up is what's called a link function, and it's actually a very small part of a larger API. If I cut this and instead I return an object and it has a property of link with that function, you'll see that this will behave the exact same way. Now this object that we are returning here is called the directive definition object, or DDO if you want an acronym for it. There's plenty of things on here for you to configure.

    I want to emphasize that the things on here such as restrict, such as template, such as templateURL, and priority, and all the other things you can put on here are really a matter of configuration. A lot of the things you'll just have to get used to, you'll memorize what you put in there. It's not a lot of writing code. When it comes to writing code a lot of it ends up in either this link function or a controller function which we'll talk about later, and in rare scenarios, when you need to use it, a compile function. But the rest of it such as restrict and other is basically configuration which you just really have to memorize.

    You'll be referring to the docs or these reference videos as you write your directive definition object.