在这个有角度的文件:
http://docs.angularjs.org/guide/concepts中,有一个关于指令的例子.
Directives
A directive is a behavior or DOM transformation which is triggered by the presence of a custom attribute,element name,or a class name. A directive allows you to extend the HTML vocabulary in a declarative fashion. Following is an example which enables data-binding for the contenteditable in HTML.
它提供了两个现场演示,一个用于plunker,另一个用于jsfiddle.
> plunker:http://plnkr.co/edit/nsAUafYFA1tHPo52TWUm?p=preview
> jsfiddle:http://jsfiddle.net/rnL84/
plunker在index.html中使用ng-app而不是ng-app =’directive’.
需要在ng-app中指定script.js javascript文件中定义的模块(在此示例中为named指令),以便它获取contenteditable指令:
angular.module(‘directive’,[])…
有关工作版本,请参阅this plunker.
原文地址:https://www.jb51.cc/angularjs/240358.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。