Преглед изворни кода

MPIDE-29: remove explicit angular DI

Removed strict dependency declarations, allowing the build process to
handle it.
Austin Meagher пре 10 година
родитељ
комит
c8c264ee77

+ 2 - 4
src/web/components/data/files.js

@@ -2,8 +2,7 @@ angular.module("modellang-ide.components.editor", [
 	"ui-ace",
 ])
 
-.factory("FilesSvc", [
-"$q",
+.factory("FilesSvc",
 function($q) {
 	var FilesSvc = {
 
@@ -107,5 +106,4 @@ function($q) {
 
 	};
 	return FilesSvc;
-},
-]);
+});

+ 3 - 9
src/web/components/editor/editor.js

@@ -6,7 +6,6 @@ angular.module("modellang-ide.components.editor", [
 ])
 
 .service("parser", //ideally this should probably be an ACE plugin but this was easier for now
-["$window", "$q",
 function($window, $q) {
 	var worker = null,
 		working = {},
@@ -47,11 +46,9 @@ function($window, $q) {
 			return work.promise;
 		}
 	};
-},
-])
+})
 
 .directive("editor",
-["$timeout", "parser",
 function($timeout, parser) {
 	return {
 		restrict: "E",
@@ -121,11 +118,9 @@ function($timeout, parser) {
 			}
 		},
 	};
-},
-])
+})
 
 .controller("EditorCtrl",
-["$scope",
 function($scope) {
 	var defaults = {
 		mode: "modellang",
@@ -150,5 +145,4 @@ function($scope) {
 		return opts;
 	}, $scope.model.options || {});
 	if (!$scope.model.data) $scope.model.data = "";
-},
-]);
+});

+ 8 - 10
src/web/components/layout/layout.js

@@ -34,9 +34,8 @@ function() {
 	};
 })
 
-.directive("layout", [
-"$window", "$compile", "LayoutService",
-function($window, $compile, Layout) {
+.directive("layout",
+function($window, $compile, LayoutService) {
 	return {
 		restrict: "E",
 		scope: true,
@@ -54,23 +53,23 @@ function($window, $compile, Layout) {
 				dimensions: scope.model.dimensions,
 				content: scope.model.data,
 			};
-			Layout.setLayout(scope.goldenLayoutConfig, element);
+			LayoutService.setLayout(scope.goldenLayoutConfig, element);
 			Object.keys(scope.templates).forEach(function(tmplName) {
 				var tmpl = scope.templates[tmplName];
-				Layout.goldenLayout.registerComponent(tmplName, function(container, state) {
+				LayoutService.goldenLayout.registerComponent(tmplName, function(container, state) {
 					var element = container.getElement();
 					element.html(tmpl);
 					$compile(element.contents())(scope.$parent);
 				});
 			});
-			Layout.goldenLayout.registerComponent("angularTemplate", function createAngularTemplate(container, state) {
+			LayoutService.goldenLayout.registerComponent("angularTemplate", function createAngularTemplate(container, state) {
 				var element = container.getElement();
 				element.html(state.template);
 				if (typeof state.template === "string") {
 					$compile(element.contents())(scope.$parent);
 				}
 			});
-			Layout.goldenLayout.init();
+			LayoutService.goldenLayout.init();
 
 			scope.$watch(
 				function getDimensions() {
@@ -81,7 +80,7 @@ function($window, $compile, Layout) {
 				},
 				function onDimensionsChanged(dim, oldDim) {
 					if (!dim) return;
-					Layout.goldenLayout.updateSize(dim.w, dim.h);
+					LayoutService.goldenLayout.updateSize(dim.w, dim.h);
 				},
 				true //deep
 			);
@@ -99,8 +98,7 @@ function($window, $compile, Layout) {
 			};
 		},
 	};
-},
-])
+})
 
 .directive("layoutRow", function() {
 	return {

+ 3 - 5
src/web/components/menu/menu.js

@@ -17,10 +17,8 @@ angular.module("modellang-ide.components.menu", [
 })
 
 .controller("MenuCtrl",
-["$scope", "$compile", "LayoutService",
-function($scope, $compile, Layout) {
-	$scope.new = function (component) { Layout.addComponent(component); };
+function($scope, $compile, LayoutService) {
+	$scope.new = function (component) { LayoutService.addComponent(component); };
 	$scope.open = function() {};
 	$scope.save = function() {};
-},
-]);
+});

+ 1 - 3
src/web/pages/home/home.js

@@ -17,7 +17,5 @@ angular.module("modellang-ide.home", [
 })
 
 .controller("HomeCtrl",
-["$scope", "$compile",
 function($scope, $compile) {
-},
-]);
+});