blob: aaed235a317d337279f16911b4b96dda03500738 (
plain)
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
|
###
# ownCloud
#
# @author Bernhard Posselt
# Copyright (c) 2012 - Bernhard Posselt <nukeawhale@gmail.com>
#
# This file is licensed under the Affero General Public License version 3 or
# later.
#
# See the COPYING-README file
#
###
###
# Various config stuff for owncloud
###
angular.module('OC', []).config ['$httpProvider', ($httpProvider) ->
# Always send the CSRF token by default
$httpProvider.defaults.get['requesttoken'] = oc_requesttoken
$httpProvider.defaults.post['requesttoken'] = oc_requesttoken
# needed because crap PHP does not understand JSON
$httpProvider.defaults.post['Content-Type'] =
'application/x-www-form-urlencoded'
$httpProvider.defaults.get['Content-Type'] =
'application/x-www-form-urlencoded'
$httpProvider.defaults.transformRequest = (data) ->
if angular.isDefined(data)
return data
else
return $.param(data)
]
angular.module('OC').run ['$rootScope', 'Router', ($rootScope, Router) ->
init = ->
$rootScope.$broadcast('routesLoaded')
# this registers a callback that is executed once the routes have
# finished loading. Before this you cant really do request
Router.registerLoadedCallback(init)
]
|