You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.2 KiB
46 lines
1.2 KiB
window.g = window
|
|
|
|
var app = angular.module('app', [])
|
|
|
|
|
|
app.config(['$interpolateProvider', '$httpProvider',
|
|
function($interpolateProvider, $httpProvider) {
|
|
$interpolateProvider.startSymbol('{(')
|
|
$interpolateProvider.endSymbol(')}')
|
|
|
|
$httpProvider.defaults.xsrfCookieName = 'csrftoken'
|
|
$httpProvider.defaults.xsrfHeaderName = 'X-CSRFToken'
|
|
|
|
$httpProvider.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'
|
|
|
|
//$routeProvider.when('/', {templateUrl: '.....'})
|
|
},
|
|
])
|
|
|
|
|
|
app.run(['$rootScope', '$timeout', '$http',
|
|
function run($rootScope, $timeout, $http) {
|
|
g.$http = $http // Debug
|
|
g.$timeout = $timeout // Debug
|
|
},
|
|
])
|
|
|
|
|
|
app.controller('TestCtrl', ['$scope', '$http', function TestCtrl($scope, $http) {
|
|
var test = g.test = this
|
|
|
|
//$http.get('/api/users/?is_admin=False').then(function(res) {
|
|
// test.users = res.data.results
|
|
//})
|
|
|
|
test.x = null
|
|
|
|
$scope.$watch(
|
|
function() {return test.x},
|
|
|
|
function(newVal, oldVal) {
|
|
if (newVal !== oldVal)
|
|
console.log(test.x)
|
|
}
|
|
)
|
|
}])
|
|
|