Last Updated: February 25, 2016
·
768
· nicktea

Keeping your global namespace clean #CoffeeScript #Angular

Pro Tip for keeping you global namespace clean using Angular and CoffeeScript:

app.coffee

@YourApp = angular.module("YourApp", ['mobile-navigate', 'ui', 'ngCookies', 'ngResource', '   filters', 'ngUpload']) 
.config(["$routeProvider", ($routeProvider) -> 

Then you easily access one global variable from your controllers etc ...

main.coffee

YourApp.controller 'MainCtrl', 
'$scope', '$route', '$location', 'CurrentUser', '$cookies', 'TokenHandler', '$http', 
($scope, $route, $location, CurrentUser, $cookies, TokenHandler, $http) ->