Why does this corner example not work on plunker?

This angular document: http://docs.angularjs.org/guide/concepts provides an example of Directives .

directives

A directive is a DOM behavior or transformation that is triggered by the presence of a user attribute, element name, or class name. The directive allows you to expand the HTML dictionary in a declarative way. The following is an example that allows you to bind data for content content in HTML.

It provides two live demos, one for plunker and one for jsfiddle.

Why is jsfiddle working well, but the plunker is not working? They have exactly the same code, and there are no errors in the console.

+6
source share
2 answers

In index.html, the plunker has ng-app instead of ng-app='directive' .

The module (with the directive name in this example) defined in the script.js file must be specified in ng-app in order to get the contenteditable directive:

angular.module('directive', [])...

See this plunker for the working version.

+3
source

Replace the script provided by Plunker with

 <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.2/angular.min.js"></script> 
+5
source

All Articles