Update: I changed my services and controller as follows and now I received an error 412 (HTTP / 1.1 412 precondition failed) Here is my updated code:
service:
appServices.factory ('appType', ['$ resource', function ($ resource) {return $ resource ("/ '_' / / web / lists / Getbaititl ( 'Todo of the list ") / item (: ID)", {id: "IID"}, {' query ': {method: "GET", isArray: false, headers: {' accept Do ':' Application / Jason; odata = nometadata '}},' update ': {vs Respect: accepted 'patch', header: { ':' application / Jason; Odata = Notadeta '}},' save ': {' acceptable '' application / Jason; Odata = Notadeta ',' Content-type: Val ()}}, 'Delete': {method: 'DELETE', Header: {'Accept': 'Application / Jason; Odata = Namedateeta', 'X-RequestDigestest': $ ("#__ REQUESTDIGEST"). App / jason; odata = nmtadata ',' content-type ':' app / jason; odata = nometadata ',' x-requestdigest ': $ ("#__ REQUESTDIGEST"). Val ()},' IF-MATCH ' : "*"},});}]);
Controller's Relevant Part:
$ scope.removeType = function (type) {appType.delete ({id: type.Id}); Console.log ("Deleted" + type.ID); }}]]); Original post: I am trying to delete an item / row in the Coerie app created at the top of SharePoint 2013 , But when I try to delete it, which appears to be the process, nothing is removed from the SharePoint list, using the Network tab in IE, I get 400 error < P> Here's my controller:
Device drivers. [ "$ Radius ',' app type, Retrieve function ($ scope, app type) {// thus $ scope.types = []; Aptaipkkyuri ({}, function (data) {$ scope.types = Data.value;}); // Type of type var typeInterview = new app type; $ scope.addType = function {Console.log ("clicked"); typeEntry.Title = $ scope.itemtype; typeEntry. $ Save ();} // Delete types $ scope.removeType = function (type) {appTypes.delete ({}, {id: type.ID}); console.log ("deleted" + type.ID);} }]));
Here's my HTML:
& lt; Table class = "table table-stripe" & gt; & Lt; TR & gt; & Lt; Th & gt; & Lt; / Th & gt; & Lt; Th & gt; Action & lt; / Th & gt; & Lt; / TR & gt; & Lt; Tr ng-repeat = "type type" id = "type {{type.Id}}" & gt; & Lt; TD & gt; {{Type.Title}} & lt; / Td> & Lt; TD & gt; & Lt; Button type = "button" class = "btn btn-threat" data-ng-click = "delete type (type)" & gt; Remove & lt; / Button & gt; & Lt; / TD & gt; & Lt; / TR & gt; & Lt; / Table & gt;
This is my service:
App Services. Fasitr ( 'app types, [ "$ resource', function (resource) (return $ resource)" / _api / web / lists / getbytitle ( 'Todo of the list ") / item", {id: "@ ID" }, {'Query': {method: "GET", isArray: false, header: {'accept': 'application / json; odata = nometadata'}}, 'update': {method: 'patch', header : {'Accept': 'application / json; odata = nometadata'}}, 'save': {method: '' '' '' 'Approval': 'Application / Jason; odata = nometadata', 'Content type "delete" application / Jason; odata = nometadata ',' X-Anuroddigenst ": $ (" #__ requested ") .val ()}}, '': {method: Delete 'headers: {' Accept ':' Ape 'ICT-MATCH': ('#__ Requestor'). Val (), 'I-MATCH': 'Application / Jason; Odata = Nmamadata', 'X-Request Didest': $ ("#__ Requestor"). '*'}}}}}}}}]); Here is some sample JSON: {"value": [{"file system object type": 0, "id": 5, "id" : 5, "ContentTipID": "0x01004CE051F4BDBACB43BB22C234F8F497FE", "Title": "Type 1", "Modified": "2015-03-13T18: 35: 09Z", "Manufactured": "2015-03-13T18: 35: 09Z "," Id "", "author id": 12, "editor id": 12, "odeta_uversian string": "1.0", "attachment": wrong, "GUID": "9ceee022-a418-43d4-86b1-1de6d68edc47"}]}
"post-text" itemprop = "text"> I am using the following headings when extracting an item from the list.
"acceptable": "application / Jason; Odata = verbose", "content-type" "application / Jason; Odata = verbose", "X-Anuroddigenst": $ ( "# __ The requester "). Val (), "If-match": "*", "X-HTP-Mathard": "Delete"
This works for me Hope it's helpful too is.
No comments:
Post a Comment