Completed the basic api and template directive