A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区
传智教育官网黑马程序员官网
只需一步,快速开始
我是楠楠
黑马粉丝团
黑马币:5364
帖子:67337
精华:0
© 我是楠楠 黑马粉丝团 / 2020-6-2 14:59 / 1366 人查看 / 1 人回复 / 1 人收藏 转载请遵从CC协议 禁止商业使用本文
<!-- 配置多媒体解析器 --> <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"> <property name="defaultEncoding" value="UTF-8"></property> <!-- 设定文件上传的最大值 5MB,5*1024*1024 --> <property name="maxUploadSize" value="5242880"></property> </bean>
//控制层 app.controller('contentController' ,function($scope,$controller ,contentService,u ploadService){
<script type="text/javascript" src="../js/service/uploadService.js"> </script>
//上传广告图 $scope.uploadFile=function(){ uploadService.uploadFile().success( function(response){ if(response.success){ $scope.entity.pic=response.message; }else{ alert("上传失败!"); } } ).error( function(){ alert("上传出错!"); } ); }
<tr> <td>图片</td> <td> <input type="file" id="file"> <button ng-click="uploadFile()">上传</button> <img alt="" src="{{entity.pic}}" height="100px" width="200px"> </td> </tr>
<img alt="" src="{{entity.pic}}" height="50px" width="100px">
//加载广告分类列表 $scope.findContentCategoryList=function(){ contentCategoryService.findAll().success( function(response){ $scope.contentCategoryList=response; } ); }
<body class="hold-transition skin-red sidebar-mini" ng-app="pinyougou" ng-controller="contentController" ng-init="findContentCategoryList()">
<select class="form-control" ng-model="entity.categoryId" ng-options="item.id as item.name for item in contentCategoryList"></select>
<input type="checkbox" ng-model="entity.status" ng-true-value="1" ng-false-value="0">
$scope.status=["无效","有效"];
{{status[entity.status]}}