3

我正在使用 Summernote Angular 指令。但是,由于某种原因,它不起作用。

问题:

它无法识别 summarnote 功能...

在此处输入图像描述

<summernote code="text"></summernote>

<script src="components/bower_components/summernote/dist/summernote.js"></script>
<script src="components/bower_components/angular-summernote/src/angular-summernote.js"></script>

ypeError: undefined is not a function
    at activate (http://localhost/tm/app/components/bower_components/angular-summernote/src/angular-summernote.js:57:15)
    at link (http://localhost/tm/app/components/bower_components/angular-summernote/src/angular-summernote.js:129:30)
    at http://localhost/tm/Scripts/angular.js:7113:44
    at nodeLinkFn (http://localhost/tm/Scripts/angular.js:6711:13)
    at compositeLinkFn (http://localhost/tm/Scripts/angular.js:6105:13)
    at compositeLinkFn (http://localhost/tm/Scripts/angular.js:6108:13)
    at nodeLinkFn (http://localhost/tm/Scripts/angular.js:6705:24)
    at compositeLinkFn (http://localhost/tm/Scripts/angular.js:6105:13)
    at publicLinkFn (http://localhost/tm/Scripts/angular.js:6001:30)
    at link (http://localhost/tm/Scripts/angular-route.js:918:7) <div class="summernote ng-isolate-scope" code="text"> angular.js:10071

我目前使用的指令是:https ://github.com/outsideris/angular-summernote/blob/master/src/angular-summernote.js

如果这不是正确的解决方案,您能否提出更好的选择。

我也尝试过:

<script src="components/bower_components/angular/angular.js"></script>
<script src="components/bower_components/summernote/dist/summernote.js"></script>
<script src="components/bower_components/angular-summernote/dist/angular-summernote.min.js"></script>
4

2 回答 2

4

This worked for me, it might work for you too:

change:

<script src="components/bower_components/summernote/dist/summernote.js"></script>
<script src="components/bower_components/angular-summernote/src/angular-summernote.js"></script>

to:

<script src="components/bower_components/summernote/dist/summernote.js"></script>
<script src="components/bower_components/angular-summernote/dist/angular-summernote.min.js">

The exact flow was running:

bower install summernote
bower install angular-summernote

and then:

<script src="components/bower_components/summernote/dist/summernote.js"></script>
<script src="components/bower_components/angular-summernote/dist/angular-summernote.min.js">
于 2014-10-05T12:36:34.610 回答
3

您必须包括 jquery 和 bootstrap,例如:

<script src="components/jquery/dist/jquery.min.js"></script>
<script src="components/bootstrap/dist/js/bootstrap.min.js"></script>

参考一个例子。这是summernote的依赖

我是 angular-summernote 的作者。

于 2014-10-08T05:08:37.473 回答