Browse Source

Replace global variable assumption with angular.module

Robert Marshall 7 years ago
parent
commit
6a6888eccd

+ 1 - 1
scripts/controllers/gallery.js

@@ -1,4 +1,4 @@
-app.controller('gallery', ["$scope", function($scope) {
+angular.module("robware").controller('gallery', ["$scope", function($scope) {
 	$scope.images=[];
 	$scope.images=[];
 	$scope.imageToShow=0;
 	$scope.imageToShow=0;
 
 

+ 1 - 1
scripts/controllers/galleryManage.js

@@ -1,4 +1,4 @@
-app.controller('galleryManage', ["$scope", "$http", function($scope, $http) {
+angular.module("robware").controller('galleryManage', ["$scope", "$http", function($scope, $http) {
 	$scope.albums=[];
 	$scope.albums=[];
 	var albumActions={};
 	var albumActions={};
 
 

+ 1 - 1
scripts/controllers/galleryUpload.js

@@ -1,4 +1,4 @@
-app.controller('galleryUpload', ["$scope", "$http", function($scope, $http) {
+angular.module("robware").controller('galleryUpload', ["$scope", "$http", function($scope, $http) {
 	$scope.images = [];
 	$scope.images = [];
 	$scope.contextMenuActions = {
 	$scope.contextMenuActions = {
 		Remove: remove,
 		Remove: remove,

+ 2 - 2
scripts/controllers/main.js

@@ -1,6 +1,6 @@
 /* global app, angular */
 /* global app, angular */
 
 
-var app = angular.module("robware", ['ngAnimate'], ["$httpProvider", function($httpProvider) {
+angular.module("robware", ['ngAnimate'], ["$httpProvider", function($httpProvider) {
 	/*
 	/*
 	 * Stolen from: http://stackoverflow.com/questions/19254029/angularjs-http-post-does-not-send-data
 	 * Stolen from: http://stackoverflow.com/questions/19254029/angularjs-http-post-does-not-send-data
 	 * Reason: send payload as form data instead of JSON, bind to controller action parameters
 	 * Reason: send payload as form data instead of JSON, bind to controller action parameters
@@ -74,7 +74,7 @@ var app = angular.module("robware", ['ngAnimate'], ["$httpProvider", function($h
 	]);
 	]);
 }]);
 }]);
 
 
-app.controller("main", ['$scope', '$rootScope', function($scope, $rootScope) {
+angular.module("robware").controller("main", ['$scope', '$rootScope', function($scope, $rootScope) {
 		var largeWindowBoundary = 1023;
 		var largeWindowBoundary = 1023;
 
 
 		$scope.menuVisible = false;//window.innerWidth > largeWindowBoundary;
 		$scope.menuVisible = false;//window.innerWidth > largeWindowBoundary;

+ 1 - 1
scripts/controllers/status.js

@@ -1,4 +1,4 @@
-app.controller('status', ["$scope", "statusService", "$interval", function($scope, statusService, $interval) {
+angular.module("robware").controller('status', ["$scope", "statusService", "$interval", function($scope, statusService, $interval) {
 	$scope.chartData=[];
 	$scope.chartData=[];
 	var chartDataId=0;
 	var chartDataId=0;
 
 

+ 1 - 1
scripts/controllers/temperature.js

@@ -1,4 +1,4 @@
-app.controller('temperature', ["$scope", "temperatureService", "$interval", function($scope, temperatureService, $interval) {
+angular.module("robware").controller('temperature', ["$scope", "temperatureService", "$interval", function($scope, temperatureService, $interval) {
 	$scope.readings = [];
 	$scope.readings = [];
 	$scope.temperatureData = {};
 	$scope.temperatureData = {};
 
 

+ 1 - 1
scripts/controllers/weight.js

@@ -1,4 +1,4 @@
-app.controller("weight", ["$scope", "weightService", function($scope, weightService) {
+angular.module("robware").controller("weight", ["$scope", "weightService", function($scope, weightService) {
 		$scope.submitting = false;
 		$scope.submitting = false;
 		$scope.weight = null;
 		$scope.weight = null;
 		$scope.fat = null;
 		$scope.fat = null;

+ 1 - 1
scripts/directives/contextMenu.js

@@ -1,4 +1,4 @@
-app.directive('contextMenu', function() {
+angular.module("robware").directive('contextMenu', function() {
 	return {
 	return {
 		restrict: 'E',
 		restrict: 'E',
 		templateUrl: '/scripts/directives/templates/contextMenu.html',
 		templateUrl: '/scripts/directives/templates/contextMenu.html',

+ 1 - 1
scripts/directives/dragDrop.js

@@ -1,4 +1,4 @@
-app.directive('dragDrop', function() {
+angular.module("robware").directive('dragDrop', function() {
 	return {
 	return {
 		restrict: 'A',
 		restrict: 'A',
 		scope: {
 		scope: {

+ 1 - 1
scripts/directives/equalHeightWidth.js

@@ -1,4 +1,4 @@
-app.directive("equalWidth", function() {
+angular.module("robware").directive("equalWidth", function() {
 	return {
 	return {
 		restrict: 'A',
 		restrict: 'A',
 		link: function(scope, element) {
 		link: function(scope, element) {

+ 1 - 1
scripts/directives/googleChart.js

@@ -1,6 +1,6 @@
 /* global google, angular */
 /* global google, angular */
 
 
-app.directive('googleChart', function() {
+angular.module("robware").directive('googleChart', function() {
 	return {
 	return {
 		restrict: 'E',
 		restrict: 'E',
 		templateUrl: '/scripts/directives/templates/googleChart.html',
 		templateUrl: '/scripts/directives/templates/googleChart.html',

+ 1 - 1
scripts/directives/scopeInit.js

@@ -1,4 +1,4 @@
-app.directive("scopeInit", function(){
+angular.module("robware").directive("scopeInit", function(){
 	return {
 	return {
         restrict : 'E',
         restrict : 'E',
 		link:function(scope, element, attributes){
 		link:function(scope, element, attributes){

+ 1 - 1
scripts/services/statusService.js

@@ -1,4 +1,4 @@
-app.service('statusService', ["$http", function($http) {
+angular.module("robware").service('statusService', ["$http", function($http) {
 	function parseProcessData(data) {
 	function parseProcessData(data) {
 		var headers = data.shift();
 		var headers = data.shift();
 		var cpuIndex = -1;
 		var cpuIndex = -1;

+ 1 - 1
scripts/services/temperatureService.js

@@ -1,4 +1,4 @@
-app.service('temperatureService', ["$http", function($http) {
+angular.module("robware").service('temperatureService', ["$http", function($http) {
 	this.getReadings = function() {
 	this.getReadings = function() {
 		return $http.get('/temperature/getreadings', {dontShowSpinner:true}).then(function(response) {
 		return $http.get('/temperature/getreadings', {dontShowSpinner:true}).then(function(response) {
 			return response.data;
 			return response.data;

+ 1 - 1
scripts/services/weightService.js

@@ -1,4 +1,4 @@
-app.service('weightService', ["$http", function($http) {
+angular.module("robware").service('weightService', ["$http", function($http) {
 	this.addWeight=function(weight, fat){
 	this.addWeight=function(weight, fat){
 		return $http({
 		return $http({
 			method:'post',
 			method:'post',