AngularJS is an awesome framework and Angular Directives make this framework super awesome :)
AngularJS directives help us extend the existing HTML DSL. You can create new tags, extend functionality using existing tag and create reusable component.
I recently created a Inplace editable control in AngularJS. It basically allows to do in place editing for elements like H1, H2, H3 div etc, basically all read only control. I took the initial idea from this fiddle and added
- Text selection on edit.
- Cursor positioning
- Handle the Enter key press.
Comments
1. Your reference to AngularUI is broken now (just remove the "." after "raw" from "http://raw.github..." and it will work.
2. You are referencing a template that doesn't exist "template: $('#editable-template')[0].innerHTML,"
3. That reference above is using jQuery, which you haven't included.
For AngularJS I find it handier to add the script references in the style box; like the official AngularJS examples do. Or just use Plunker instead!
I'd be interested in seeing a working solution of your directive.
See example here:
http://jsfiddle.net/gavinfoley/DJKmW/