'use strict';

app.config(function ($httpProvider, $modalProvider) {
  
  //Enable cross domain calls
  $httpProvider.defaults.useXDomain = true;

  //Remove the header used to identify ajax call  that would prevent CORS from working
  delete $httpProvider.defaults.headers.common['X-Requested-With'];


  //Overwriting the modal's default options 
  angular.extend($modalProvider.defaults, {
    placement: 'center',
    keyboard: false
  });
});


//Overwriting the default modal template to show an `OK` button instead of the default `Close` button
app.run(['$templateCache', function($templateCache) {
  $templateCache.put('modal/modal.tpl.html', '<div class="modal" tabindex="-1" role="dialog"><div class="modal-dialog"><div class="modal-content"><div class="modal-header" ng-show="title"><button type="button" class="close" ng-click="$hide()">&times;</button><h4 class="modal-title" ng-bind="title"></h4></div><div class="modal-body" ng-bind="content"></div><div class="modal-footer"><button type="button" class="btn btn-primary" ng-click="$hide()">OK</button></div></div></div></div>');
}]);