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
Did you know?
Angular apps often share the page with analytics and payment scripts that are not Angular modules. Those scripts execute on the same origin as the framework.
Security insights from Cside
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#