Good afternoon! I am not able to create the functionality of editing and removing an object from a vector with angular, could someone help me? below is the controller code and the service:
angular.module("appOS").controller("CadastroServicoCtrl",function($scope, Servicos,$location,$timeout){
$scope.servicos = Servicos.listar();
$scope.adicionarServico = function(servico){
$scope.exibirMsg = false;
var id = $scope.servicos.length;
servico.codigo = (id + 1);
Servicos.adicionar(angular.copy(servico));
delete $scope.servico;
$scope.servicoForm.$setPristine();
$timeout(function(){
$scope.exibirMsg = true;
$scope.mensagem = "Serviço Cadastrado com Sucesso!";
}, 2000);
};
});
angular.module("appOS").factory("Servicos", function(){
var servicos = [];
return {
listar: function(){
return servicos;
},
adicionar: function(servico){
servicos.push(angular.copy(servico));
delete servico;
},
remover:function(id){
}
}
});