我正在应用程序中添加和编辑设备,并且希望根据API响应显示toastr
angular.module("myApp", ['ui.bootstrap', 'toastr']).controller("myController", function ($scope, $http, $uibModal, toastr, $timeout) {
` if (newName) {
$http.post('/api/Device/AddDevice', { name: newName })
.then(function () {
toastr.success("Device added","Sucess")
$http.get('/api/Device/GetAllDevices')
.then(function (response) {
$scope.devices = response.data;
})
.catch(function (error) {
console.error('Error fetching devices:', error);
});
})
}
PS:这不是全部代码
1条答案
按热度按时间exdqitrt1#