Skip to content

Instantly share code, notes, and snippets.

@Ulv
Created May 28, 2014 08:18
Show Gist options
  • Select an option

  • Save Ulv/377f569897b9dd19f87c to your computer and use it in GitHub Desktop.

Select an option

Save Ulv/377f569897b9dd19f87c to your computer and use it in GitHub Desktop.
angularjs, coffeescript: app dataService (with promise)
# Usage examples:
#
# dataService.getTree().then((response)->
# if response
# $scope.list = response.data
#
# dataService.saveTree(nodeData)
.service "dataService", ($http) ->
delete $http.defaults.headers.common["X-Requested-With"]
@getTree = ->
$http
method: "GET"
url: "/admin/widget-menu/menutree/get"
@saveTree = (data) ->
$http.post "/admin/widget-menu/menutree/save",
JSON.stringify data
return
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment