主要是上传图片的配置。

(function () {
if (typeof angular === 'undefined') {
return;
}

angular.module('editorContainer', [])
//.constant('uiBsEditor', { uiEditor: {} })
.directive('contenteditable', function () {
return {
restrict: 'A',
//scope:true,
//scope: { 'id': '&id' },
require: 'ngModel',
link: function ($scope, element, attrs, ctrl) {
// 创建编辑器
//scope = $scope;
var editor = new wangEditor(element);

//1.改名很重要,因为files不改的话,会报告参数不一样
editor.config.uploadImgFileName = "files";

//2.上传路径
editor.config.uploadImgUrl = attrs.upimageurl|| ''; //$scope.vm.editer.upimageurl;// '/fileupload/postimage';

// editor.config.uploadHeaders = attrs.token || '';

//3.防XSRF
if (attrs.token) {
editor.config.uploadHeaders = {
'X-XSRF-TOKEN': attrs.token 
};
}

//editor.config.customUpload = true; // 配置自定义上传的开关
//editor.config.customUploadInit = $scope.vm.uploadFiles; // 配置上传事件,uploadInit方法已经在上面定义了
editor.config.hideLinkImg = true;
editor.config.menus = [
'source',
'|',
'bold',
'underline',
'italic',
'strikethrough',
'eraser',
'forecolor',
'bgcolor',
'|',
'quote',
'fontfamily',
'fontsize',
'head',
'unorderlist',
'orderlist',
'alignleft',
'aligncenter',
'alignright',
'|',
'link',
'unlink',
'table',
'emotion',
'|',
'img',
'video',
'|',
'undo',
'redo',
'fullscreen'
];

ctrl.$render = function () {
element.html(ctrl.$viewValue || '');
};

editor.onchange = function () {
// 从 onchange 函数中更新数据
$scope.$apply(function () {
var html = editor.$txt.html();
ctrl.$setViewValue(html);
});
};

editor.create();

$scope.$on('$destroy', function () {

editor.destroy();
delete editor;
});
}
};
});
})();

前台html

<div ng-model="vm.internalclassinfo.classInfo" upimageurl="{{vm.uploadurl}}" token="{{vm.token}}" contenteditable="true" style="height:350px;"></div>

前台js

vm.uploadurl = abp.appPath + "FileUpload/Upload2?uptype=cmsimage";
vm.token = abp.security.antiForgery.getToken();

后台

public string Upload2(IEnumerable<HttpPostedFileBase> files)

这里只写一个定义即可。

关键点已加红字。

abp 中wangEditor-angular 的使用的更多相关文章

  1. ABP中使用Redis Cache(1)

    本文将讲解如何在ABP中使用Redis Cache以及使用过程中遇到的各种问题.下面就直接讲解使用步骤,Redis环境的搭建请直接网上搜索. 使用步骤: 一.ABP环境搭建 到http://www.a ...

  2. JS组件系列——在ABP中封装BootstrapTable

    前言:关于ABP框架,博主关注差不多有两年了吧,一直迟迟没有尝试.一方面博主觉得像这种复杂的开发框架肯定有它的过人之处,系统的稳定性和健壮性比一般的开源框架肯定强很多,可是另一方面每每想到它繁琐的封装 ...

  3. ABP源码分析二:ABP中配置的注册和初始化

    一般来说,ASP.NET Web应用程序的第一个执行的方法是Global.asax下定义的Start方法.执行这个方法前HttpApplication 实例必须存在,也就是说其构造函数的执行必然是完成 ...

  4. ABP源码分析三十五:ABP中动态WebAPI原理解析

    动态WebAPI应该算是ABP中最Magic的功能之一了吧.开发人员无须定义继承自ApiController的类,只须重用Application Service中的类就可以对外提供WebAPI的功能, ...

  5. ABP源码分析四十七:ABP中的异常处理

    ABP 中异常处理的思路是很清晰的.一共五种类型的异常类. AbpInitializationException用于封装ABP初始化过程中出现的异常,只要抛出AbpInitializationExce ...

  6. ABP中使用Redis Cache(2)

    上一篇讲解了如何在ABP中使用Redis Cache,虽然能够正常的访问Redis,但是Redis里的信息无法同步更新.本文将讲解如何实现Redis Cache与实体同步更新.要实现数据的同步更新,我 ...

  7. ABP中使用OAuth2(Resource Owner Password Credentials Grant模式)

    ABP目前的认证方式有两种,一种是基于Cookie的登录认证,一种是基于token的登录认证.使用Cookie的认证方式一般在PC端用得比较多,使用token的认证方式一般在移动端用得比较多.ABP自 ...

  8. 在Abp中集成Swagger UI功能

    在Abp中集成Swagger UI功能 1.安装Swashbuckle.Core包 通过NuGet将Swashbuckle.Core包安装到WebApi项目(或Web项目)中. 2.为WebApi方法 ...

  9. 记载abp中Dbcontext的疑问

    q:abp中httpcontext如何在一次请求中保证获取的是相同的实例. 大牛的原话: LifestylePerWebRequest does not works good with async. ...

  10. ABP中动态WebAPI原理解析

    ABP中动态WebAPI原理解析 动态WebAPI应该算是ABP中最Magic的功能之一了吧.开发人员无须定义继承自ApiController的类,只须重用Application Service中的类 ...

随机推荐

  1. 制作推送证书 and Code=3000 "未找到应用程序的“aps-environment”的权利字符串"

    制作推送证书 step1. 打开苹果开发者网站 step2. 从Member Center进入Certificates, Identifiers & Profiles step3. 选择要制作 ...

  2. 【spring data jpa】spring data jpa 中的update 更新字段,如果原字段值为null不处理,不为null则在原来的值上加一段字符串

    示例代码: /** * 如果barCode字段值为null则不处理 * 如果barCode字段值不为null则在原本值的前面拼接 del: * @param dealer * @return */ @ ...

  3. 设置cookie和查找cookie的方法

    1.设置cookie(名称,值,过期时间) function setCookie(key,value,d){ if(d === undefined){ document.cookie = encode ...

  4. [Android Traffic] Android网络开启、关闭整理

    转载: http://blog.csdn.net/tu_bingbing/article/details/8469871 近段时间由于要对手机网络状况进行判断.开启和关闭,从网上找了些资料,现整理如下 ...

  5. gulp的入门浅析

    阅读目录 介绍gulp 安装gulp gulpfile.js 运行gulp 介绍gulp的api 介绍gulp gulp是基于Nodejs的自动任务运行器, 她能自动化地完成 javascript/c ...

  6. Directive Controller And Link Timing In AngularJS

    I've talked about the timing of directives in AngularJS a few times before. But, it's a rather compl ...

  7. netty handlers模式

    netty的handler模式真的挺方便的,可以像插件一样随意的插入自己新增的功能而不用队系统进行大的变动. 下面我们来看一下这个模式是如何实现和运行的. 待续...

  8. 再次学习mysql优化

    再次学习mysql优化 表的设计规范化(三范式) 添加索引(普通索引.主键索引.唯一索引.全文索引) 分表(水平分割.垂直分割) 读写分离(写add.update.delete) 存储过程 对mysq ...

  9. web 前端 常见操作 将时间戳转成日期格式 字符串截取 使用mui制作选项卡

    1.将时间戳转成日期格式: //第一种 function getLocalTime(nS) { return new Date(parseInt(nS) * 1000).toLocaleString( ...

  10. windows系统下GCC的安装与配置

    刚开始看 C++ Primer,看到编译器的部分,自己搜了搜怎么搭建GCC,搜到以下内容,复制过来留个印象: windows系统下GCC的安装方法,以及一些环境变量的配置,如果对GCC不是很清楚,关于 ...