Fórum Não é possível encontrar o recurso - AngularJS ASP.NET MVC #604677
19/08/2019
0
Alguém tem ideia o que pode ser o erro?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | var app = angular.module( "myApp" , []); app.controller( "myCtrl" , function ($scope, $http) { debugger; $scope.InsertData = function () { var Action = document.getElementById( "btnSave" ).getAttribute( "value" ); if (Action == "Gravar" ) { $scope.Chamado = {}; $scope.Chamado.Titulo = $scope.ChamTitulo; $scope.Chamado.Descricao = $scope.ChamDescricao; $scope.Chamado.Cadastro = $scope.ChamCadastro; $scope.Chamado.Prioridade = $scope.ChamPrioridade; $scope.Chamado.Atendente = $scope.ChamAtendente; $http({ method: "post" , datatype: "json" , data: JSON.stringify($scope.Chamado) }).then( function (response) { alert(response.data); $scope.GetAllData(); $scope.ChamTitulo = "" ; $scope.ChamDescricao = "" ; $scope.ChamCadastro = "" ; $scope.ChamPrioridade = "" ; $scope.ChamAtendente = "" ; }) } else { $scope.Chamado = {}; $scope.Chamado.Titulo = $scope.ChamTitulo; $scope.Chamado.Descricao = $scope.ChamDescricao; $scope.Chamado.Cadastro = $scope.ChamCadastro; $scope.Chamado.Prioridade = $scope.ChamPrioridade; $scope.Chamado.Atendente = $scope.ChamAtendente; $scope.Chamado.ChamadoID = document.getElementById( "ChamID_" ).value; $http({ method: "post" , datatype: "json" , data: JSON.stringify($scope.Chamado) }).then( function (response) { alert(response.data); $scope.GetAllData(); $scope.ChamTitulo = "" ; $scope.ChamDescricao = "" ; $scope.ChamCadastro = "" ; $scope.ChamPrioridade = "" ; $scope.ChamAtendente = "" ; document.getElementById( "btnSave" ).setAttribute( "value" , "Gravar" ); document.getElementById( "btnSave" ).style.backgroundColor = "cornflowerblue" ; document.getElementById( "spn" ).innerHTML = "Adicionar novo chamado" ; }) } } $scope.GetAllData = function () { $http({ method: "get" , }).then( function (response) { $scope.chamados = response.data; }, function () { alert( "Error Occur" ); }) }; $scope.DeleteCham = function (Cham) { $http({ method: "post" , datatype: "json" , data: JSON.stringify(Cham) }).then( function (response) { alert(response.data); $scope.GetAllData(); }) }; $scope.UpdateCham = function (Cham) { document.getElementById( "ChamID_" ).value = Cham.ChamadoID; $scope.ChamTitulo = Cham.Titulo; $scope.ChamDescricao = Cham.Descricao; $scope.ChamCadastro = Cham.Cadastro; $scope.ChamPrioridade = Cham.Prioridade; $scope.ChamAtendente = Cham.Atendente; document.getElementById( "btnSave" ).setAttribute( "value" , "Alterar" ); document.getElementById( "btnSave" ).style.backgroundColor = "Yellow" ; document.getElementById( "spn" ).innerHTML = "Alterar chamado" ; } }) |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | @{ ViewBag.Title = "Index"; } < script src = "~/Scripts/angular.js" ></ script > < script src = "~/Scripts/AngularCode.js" ></ script > < style > .btn-space { margin-left: -5%; background-color: cornflowerblue; font-size: large; } </ style > < h2 >Index</ h2 > < div ng-app = "myApp" > < div ng-controller = "myCtrl" ng-init = "GetAllData()" class = "divList" > < p class = "divHead" >Lista de chamados</ p > < table cellpadding = "12" class = "table table-bordered table-hover" > < tr > < td > < b >ID</ b > </ td > < td > < b >Titulo</ b > </ td > < td > < b >Descricao</ b > </ td > < td > < b >Cadastro</ b > </ td > < td > < b >Prioridade</ b > </ td > < td > < b >Atendente</ b > </ td > </ tr > < tr ng-repeat = "Cham in chamado" > < td > {{Cham.ChamadoID}} </ td > < td > {{Cham.Titulo}} </ td > < td > {{Cham.Descricao}} </ td > < td > {{Cham.Cadastro}} </ td > < td > {{Cham.Prioridade}} </ td > < td > {{Cham.Atendente}} </ td > < td > < input type = "button" class = "btn btn-warning" value = "Alterar" ng-click = "UpdateCham(Cham)" /> < input type = "button" class = "btn btn-danger" value = "Apagar" ng-click = "DeleteCham(Cham)" /> </ td > </ tr > </ table > < div class = "form-horizontal" role = "form" > < div class = "container" > < div class = "row" > < h2 > < span id = "spn" >Adicionar novo chamado</ span > </ h2 > </ div > < div class = "row" > < div class = "col-sm-6 col-lg-4" > < div class = "form-group" > < label class = "col-md-4 control-label" >Título:</ label > < div class = "col-md-8" > < input type = "text" class = "form-control" id = "inputTitulo" placeholder = "Título" ng-model = "ChamTitulo" > </ div > </ div > </ div > < div class = "col-sm-6 col-lg-4" > < div class = "form-group" > < label class = "col-md-4 control-label" >Descrição:</ label > < div class = "col-md-8" > < input type = "text" class = "form-control" id = "inputDescricao" placeholder = "Descrição" ng-model = "ChamDescricao" > </ div > </ div > </ div > < div class = "col-sm-6 col-lg-4" > < div class = "form-group" > < label class = "col-md-4 control-label" >Cadastro:</ label > < div class = "col-md-8" > < input type = "date" class = "form-control" id = "inputCadastro" ng-model = "ChamCadastro" > </ div > </ div > </ div > < div class = "col-sm-6 col-lg-4" > < div class = "form-group" > < label class = "col-md-4 control-label" >Prioridade:</ label > < div class = "col-md-8" > < input type = "text" class = "form-control" id = "inputPrioridade" placeholder = "Prioridade" ng-model = "ChamPrioridade" > </ div > </ div > </ div > < div class = "col-sm-6 col-lg-4" > < div class = "form-group" > < label class = "col-md-4 control-label" >Atendente:</ label > < div class = "col-md-8" > <input type="text" class="form-control" id="input |

Luis Fregonesi
Curtir tópico
+ 0
Responder
Clique aqui para fazer login e interagir na Comunidade :)