Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

- removed unneeded controllers.js

- use booter.js to create namespaces and avoid polluting the global namespace with conrollers
  • Loading branch information...
commit 959ee93377a2df437c846a6830970ba18e77470d 1 parent 6588bb6
@cburgdorf authored
View
1  app/index.html
@@ -7,6 +7,7 @@
</head>
<body>
<ng:view></ng:view>
+ <script src="js/booter.js"></script>
<script src="lib/angular/angular.js" ng:autobind></script>
<script src="js/services.js"></script>
<script src="js/controllers.js"></script>
View
2  app/js/booter.js
@@ -0,0 +1,2 @@
+var App = {};
+App.Controllers = {};
View
22 app/js/controllers.js
@@ -1,7 +1,6 @@
/* App Controllers */
-
-function MyCtrl1() {
+App.Controllers.TodoController =function () {
var self = this;
self.newTodo = "";
@@ -66,21 +65,4 @@ function MyCtrl1() {
};
}
-MyCtrl1.$inject = [];
-
-
-function MyCtrl2($location) {
- var self = this;
-
- self.users = [{
- firstName: "Max"
- },
- {
- firstName: "Steffi"
- }];
-
- self.goBack = function(){
- $location.update({hashPath: '/view1'});
- };
-}
-MyCtrl2.$inject = ['$location'];
+App.Controllers.TodoController.$inject = [];
View
2  app/js/services.js
@@ -5,7 +5,7 @@
*/
angular.service('myAngularApp', function($route, $location, $window) {
- $route.when('/main', {template: 'partials/main.html', controller: MyCtrl1});
+ $route.when('/main', {template: 'partials/main.html', controller: App.Controllers.TodoController});
$route.when('/credits', {template: 'partials/credits.html'});
var self = this;
Please sign in to comment.
Something went wrong with that request. Please try again.