加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

为什么这个angularjs例子对plunker不起作用?

发布时间:2020-12-17 10:16:25 所属栏目:安全 来源:网络整理
导读:在这个有角度的文件: 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 direc
在这个有角度的文件: 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/

为什么jsfiddle运行良好,但是一个不起作用?它们具有完全相同的代码,并且控制台中没有错误.

plunker在index.html中使用ng-app而不是ng-app =’directive’.

需要在ng-app中指定script.js javascript文件中定义的模块(在此示例中为named指令),以便它获取contenteditable指令:

angular.module(‘directive’,[])…

有关工作版本,请参阅this plunker.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读