Javascript tinymce指令后AngularJS导航不起作用
我有个问题我想不出来,但我有个提示。在集成TinyMCE之前,主导航工作良好,例如链接设置、分析、设置;如果单击它们,它现在不起作用 这是我的js文件:Javascript tinymce指令后AngularJS导航不起作用,javascript,tinymce,angularjs,Javascript,Tinymce,Angularjs,我有个问题我想不出来,但我有个提示。在集成TinyMCE之前,主导航工作良好,例如链接设置、分析、设置;如果单击它们,它现在不起作用 这是我的js文件: var app_htmleditor_module = angular.module('app_htmleditor', ['components']). config(['$routeProvider', function($routeProvider) { $routeProvider. wh
var app_htmleditor_module = angular.module('app_htmleditor', ['components']).
config(['$routeProvider', function($routeProvider) {
$routeProvider.
when('/', {templateUrl: getBaseURL()+'public/tpl/app/htmleditor.htm', controller: HtmlEditorCtrl, reloadOnSearch:false }).
otherwise( {redirectTo: '/'});
}
]);
angular.module('components', []).directive('imageUpload', function () {
return {
restrict: 'E',
scope: {
uploaderid:'@uploaderid'
},
templateUrl: '/public/tpl/imageupload.htm'
}
});
app_htmleditor_module.directive('uiTinymce', function() {
return {
require: 'ngModel',
link: function(scope, element, attrs, ngModel) {
element.tinymce({
// Location of TinyMCE script
script_url: 'http://resources.holycrap.ws/jscripts/tiny_mce/tiny_mce.js',
// General options
theme: "simple",
// Change from local directive scope -> "parent" scope
// Update Textarea and Trigger change event
// you can also use handle_event_callback which fires more often
onchange_callback: function(e) {
if (this.isDirty()) {
this.save();
// tinymce inserts the value back to the textarea element, so we get the val from element (work's only for textareas)
//ngModel.$setViewValue(e.getBody().innerHTML);
ngModel.$setViewValue(element.val());
scope.$apply();
return true;
}
}
});
}
}
});
我使用ui:tinymce
将上面的tinymce指令添加到textarea中,如下所示:
<textarea ui:tinymce ng-model="data.html_tab" id="{{fileUploaderID}}_html_tab" name="{{fileUploaderID}}_html_tab" style="width:600px; height:300px"></textarea>
然后在我的js文件中,我添加了:
var app_htmleditor_module = angular.module('app_htmleditor', ['components', 'ui']).
config(['$routeProvider', function($routeProvider) {
$routeProvider.
when('/', {
templateUrl: getBaseURL()+'public/tpl/app/htmleditor.htm',
controller: HtmlEditorCtrl,
reloadOnSearch:false
}).
otherwise( {redirectTo: '/'});
}
]);
app_htmleditor_module.value('ui.config', {
tinymce: {
theme: 'simple'
}
});
和文本区域标记:
<textarea ui-tinymce ng-model="tinymce" id="{{fileUploaderID}}_html_tab" name="{{fileUploaderID}}_html_tab" style="width:600px; height:300px"></textarea>
虽然ui js文件添加得很好,但我通过查看源代码并单击链接确认您是否在angular ui库中尝试了最新版本的tinymce指令
谢谢您的回复。我不确定我只是从这里引用了示例代码:我只是在使用这个文件,其他什么都不用(例如没有ui):
angular-1.0.1.js
我们可以用最新版本试试,希望它能起作用。您找到的版本可能已过期/不再工作。要快速测试,只需将
添加到HTML中,并编辑模块声明,将ui
添加到应用程序中:angular.module('myApp',['ui')代码>。然后你可以试着像例子中那样做ui tinymce。试过了,但是我得到了错误,请查看更新的问题和细节,确保你也包括tinymce js文件<代码>
<textarea ui-tinymce ng-model="tinymce" id="{{fileUploaderID}}_html_tab" name="{{fileUploaderID}}_html_tab" style="width:600px; height:300px"></textarea>
ReferenceError: tinymce is not defined