当前位置:Gxlcms > 数据库问题 > angular js 页面添加数据保存数据库

angular js 页面添加数据保存数据库

时间:2021-07-01 10:21:17 帮助过:9人阅读


if ($scope.entity.id!=null){
url="../brand/update.do"
}
//发送请求$http.post(url,$scope.entity),第一个参数是请求地址,第二个参数是提交的数据
$http.post(url,$scope.entity).success(function (response) {
if(response.success){
//重新加载
return $scope.reloadList();
}else {
alert(response.message);
}
});
}
//ng-model="entity.name",封装到对象,才可以进行保存:name=>>entity=>>$scope=>>调save()方法存入数据库
<tr>
<td>品牌名称</td>
<td><input class="form-control" placeholder="品牌名称" ng-model="entity.name" > </td>
</tr>
<tr>
<td>首字母</td>
<td><input class="form-control" placeholder="首字母" ng-model="entity.firstChar" > </td>
</tr>
//ng-click="entity={}"点击新建清空缓存,新建页面数据栏为空,不给空值有缓存数据
<button ng-click="entity={}" type="button" class="btn btn-default" title="新建"
data-toggle="modal" data-target="#editModal" ><i class="fa fa-file-o"></i> 新建</button>
<button class="btn btn-success" data-dismiss="modal" aria-hidden="true" ng-click="save()">保存</button>

angular js 页面添加数据保存数据库

标签:targe   print   port   static   OLE   toggle   tac   type   click   

人气教程排行