angularJs实现修改功能
2024-09-06 00:09:23
思路: 对表单中内容进行修改,首先需要获取这个内容,再进行修改,再清空弹窗中的内容
//查询实体
$scope.findOne=function(id){
$http.get('../brand/findOne.do?id='+id).success(
function(response){
$scope.entity= response;
}
);
}
第一步获取相应实体'
<button type="button" class="btn bg-olive btn-xs" data-toggle="modal"
data-target="#editModal" ng-click="findOne(entity.id)" >修改</button>
第二步保存数据:
$scope.save=function(){
var methodName='add';//方法名称
if($scope.entity.id!=null){//如果有 ID
methodName='update';//则执行修改方法
}
$http.post('../brand/'+ methodName +'.do',$scope.entity ).success(
function(response){
if(response.success){
//重新查询
$scope.reloadList();//重新加载
}else{
alert(response.message);
}
}
);
}
最新文章
- Rabin-Karp指纹字符串查找算法
- css文件 引用后不起作用
- JS 判断字串字节数,并截取长度
- 关于WEB 性能优化 (摘抄)
- jquery 判断网络资源,网络文件是否存在
- language model —— basic model 语言模型之基础模型
- Nginx下用webbench进行压力测试
- python paramiko ssh.exec_command()启动tomcat服务器应用进程失败问题解决方法- Neither the JAVA_HOME nor the JRE_HOME environment variable is defined At least one of these environment variable is needed to run this progr
- Qt之QSequentialAnimationGroup
- php 序列化(serialize)格式详解
- esui控件validatebox 通过正则判断输入 json传值
- DevExpress GridControl 列中显示图片
- MySQL Left Join,Right Join
- EasyUI - 后台管理系统 - 登陆模块
- Java反射获取字节码以及判断类型
- jdbcTemplate批量插入处理数据
- redis实战笔记
- 2018.12/6 js键盘事件 DOM:0级2级
- 【Sql Server】SQL SERVER 收缩日志
- python迭代器的说明
热门文章
- wamp集成环境下mysql数据库的分开部署和远程访问
- 1.《Spring学习笔记-MVC》系列文章,讲解返回json数据的文章共有3篇,分别为:
- 安装zabbix-agent报错 Error: failure: repodata/primary.xml.gz from zabbix: [Errno 256] No more mirrors to try.
- Linux 2.6 中的文件锁
- 前端学习笔记2017.6.12 CSS控制DIV
- 51NOD 1371填数字
- Linux网络服务管理命令
- CLRMonitor - 跟踪CLR内部执行过程工具
- Windows系统编程之进程同步试验
- GetTop(),GetTopLeft()等等