Sha256: 4b0688e2330530649ee975a8f0af97e86703244f567276c9b31949d274adaa00

Contents?: true

Size: 980 Bytes

Versions: 15

Compression:

Stored size: 980 Bytes

Contents

console.log "Initializing Angular App"
app = angular.module( "HappySeed", ["ngResource", "ngRoute"])

app.config(["$httpProvider", (p) ->
  m = document.getElementsByTagName('meta')
  for i in m 
    p.defaults.headers.common['X-CSRF-Token'] = i.content if i.name == 'csrf-token'
])

app.config(['$routeProvider', ($routeProvider) ->
  $routeProvider.
    otherwise({redirectTo: '/landing'});
])


safeApply = (scope, fn) ->
  if( scope.$$phase || scope.$root.$$phase )
    fn()
  else
    scope.$apply(fn)

app.directive 'onEsc', ->
  link: (scope, elm, attr) ->
    elm.bind 'keydown', (e)->
      if( e.keyCode == 27 )
        scope.$apply attr.onEsc

app.directive 'onEnter', ->
  link: (scope, elm, attr) ->
    elm.bind 'keydown', (e) ->
      if( e.keyCode == 13 )
        scope.$apply attr.onEnter

app.directive 'onTab', ->
  link: (scope, elm, attr) ->
    elm.bind 'keydown', (e) ->
      if( e.keyCode == 9 )
        e.preventDefault()
        scope.$apply attr.onTab

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
happy_seed-0.0.16 lib/generators/happy_seed/angular_install/templates/app/assets/javascripts/angular_app.js.coffee.erb
happy_seed-0.0.15 lib/generators/happy_seed/angular_install/templates/app/assets/javascripts/angular_app.js.coffee.erb
happy_seed-0.0.14 lib/generators/happy_seed/angular_install/templates/app/assets/javascripts/angular_app.js.coffee.erb
happy_seed-0.0.13 lib/generators/happy_seed/angular_install/templates/app/assets/javascripts/angular_app.js.coffee.erb
happy_seed-0.0.12 lib/generators/happy_seed/angular_install/templates/app/assets/javascripts/angular_app.js.coffee.erb
happy_seed-0.0.11 lib/generators/happy_seed/angular_install/templates/app/assets/javascripts/angular_app.js.coffee.erb
happy_seed-0.0.10 lib/generators/happy_seed/angular_install/templates/app/assets/javascripts/angular_app.js.coffee.erb
happy_seed-0.0.9 lib/generators/happy_seed/angular_install/templates/app/assets/javascripts/angular_app.js.coffee.erb
happy_seed-0.0.8 lib/generators/happy_seed/angular_install/templates/app/assets/javascripts/angular_app.js.coffee.erb
happy_seed-0.0.7 lib/generators/happy_seed/angular_install/templates/app/assets/javascripts/angular_app.js.coffee.erb
happy_seed-0.0.6 lib/generators/happy_seed/angular_install/templates/app/assets/javascripts/angular_app.js.coffee.erb
happy_seed-0.0.5 lib/generators/happy_seed/angular_install/templates/app/assets/javascripts/angular_app.js.coffee.erb
happy_seed-0.0.4 lib/generators/happy_seed/angular_install/templates/app/assets/javascripts/angular_app.js.coffee.erb
happy_seed-0.0.3 lib/generators/happy_seed/angular_install/templates/app/assets/javascripts/angular_app.js.coffee.erb
happy_seed-0.0.2 lib/generators/happy_seed/angular_install/templates/app/assets/javascripts/angular_app.js.coffee.erb