lib/nestene/ui/public/app/application.js in nestene-0.1.1 vs lib/nestene/ui/public/app/application.js in nestene-0.1.2
- old
+ new
@@ -1,12 +1,17 @@
-var nestene = angular.module('nestene', ['JSONedit']);
+var nestene = angular.module('nestene', ['JSONedit']).config(function($locationProvider) {
+ $locationProvider.html5Mode({
+ enabled: true,
+ requireBase: false
+ });
+});
-nestene.controller('AutonsController', function($scope, $http, $timeout) {
+nestene.controller('AutonsController', function($scope, $http, $timeout, $location) {
$scope.autons=[];
$scope.getAutons = function() {
- var autonsPromise = $http.get("autons.json");
+ var autonsPromise = $http.get($location.path() + "autons.json");
autonsPromise.success(function(data, status, headers, config) {
$scope.autons = data;
});
autonsPromise.error(function(data, status, headers, config) {
@@ -23,30 +28,30 @@
$scope.intervalFunction();
});
-nestene.controller('CreateAutonFormController', function($scope,$http) {
+nestene.controller('CreateAutonFormController', function($scope,$http, $location) {
$scope.autonType = '';
$scope.createAuton = function() {
- var postPromise = $http.post("autons",{auton_type: $scope.autonType});
+ var postPromise = $http.post($location.path() + "autons",{auton_type: $scope.autonType});
postPromise.success(function(data, status, headers, config) {
$.bootstrapGrowl("Created "+data['auton_id'], { type: 'success' });
});
postPromise.error(function(data, status, headers, config) {
$.bootstrapGrowl("Could not create Auton: "+data['message'], { type: 'error' });
});
};
});
-nestene.controller('CredentialsController', function($scope,$http) {
+nestene.controller('CredentialsController', function($scope,$http, $location) {
$scope.credentials={};
$scope.loaded = false;
$scope.loadCredentials = function() {
- var getPromise = $http.get("credentials");
+ var getPromise = $http.get($location.path() + "credentials");
getPromise.success(function(data, status, headers, config) {
$scope.credentials = data;
$scope.loaded = true;
});
@@ -56,10 +61,10 @@
}
$scope.loadCredentials();
$scope.storeCredentials = function() {
- var postPromise = $http.post("credentials",$scope.credentials);
+ var postPromise = $http.post($location.path() + "credentials",$scope.credentials);
postPromise.success(function(data, status, headers, config) {
$.bootstrapGrowl("Credentials saved", { type: 'success' });
});
postPromise.error(function(data, status, headers, config) {
$.bootstrapGrowl("Could not save credentials", { type: 'danger' });