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) ->
Written by Nick Treadway
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Coffeescript
Authors
iam4x
94.17K
ericdfields
63.02K
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#