parse.com - AngularJS, Parse REST Api, and jQuery UI Sortable problems -
i have sortable , angular working together, have no idea send sortable list parse rest api. ( have 3 list need submit @ once different ng-models.) whats best way post , update/delete these list.
angular.module('sslive') .factory('listfactory', ['$http', '$location', 'parse_uri', '$cookiestore', 'parse_headers', function ($http, $location, parse_uri, $cookiestore, parse_headers) { var getlist = function () { return $http.get(parse_uri + 'classes/setlist', parse_headers); }; var addlist = function (list) { $http.post(parse_uri + 'classes/setlist', list, parse_headers) .success(function () { $location.path('/dashboard'); }); }; var updatelist = function () { $http.put(parse_uri + 'classes/setlist:rid', parse_headers) .sucess(function () { $location.path('/dashboard'); }) }; var deletelist = function (id) { return $http.delete(parse.uri + 'classes/list/' + id, parse_headers); }; return { getlist: getlist, addlist: addlist, updatelist: updatelist, deletelist: deletelist } }]); angular.module('sslive') .controller('listctrl', ['$scope', 'listfactory', '$routeparams', function ($scope, listfactory, $routeparams) { listfactory.getlist().success(function (data) { $scope.lists = data.results; }); $scope.addlist = function (list) { listfactory.addlist(list); } }]); <div class="allsets" ng-controller="listctrl"> <div class="set1"> <h3>set 1</h3> <br> <ul id="sortable2" class="droptrue"> <input type="hidden" ng-model="l.set1"> </ul> </div> <div class="set2"> <h3>set 2</h3> <br> <ul id="sortable3" class="droptrue" ng-model="l.set2"></ul> </div> <div class="set3"> <h3>set 3</h3> <br> <ul id="sortable4" class="droptrue" ng-model="l.set3"></ul> </div> <br> <br style="clear:both"> <div class="setsubmit"> <button type="submit">add sets</button> </div> </div>
Comments
Post a Comment