Sha256: b6eaa06d586936e5f2d1b8a89c84da8023ba1bfc0485a200b048a5fa1dc9a736

Contents?: true

Size: 1.04 KB

Versions: 4

Compression:

Stored size: 1.04 KB

Contents

@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.    when('/landing',            {templateUrl: '<%= asset_path('landing.html' )%>',  controller: 'LandingCtrl'}).


    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

4 entries across 4 versions & 1 rubygems

Version Path
happy_seed-0.0.21 lib/generators/happy_seed/angular_install/templates/app/assets/javascripts/angular_app.js.coffee.erb
happy_seed-0.0.19 lib/generators/happy_seed/angular_install/templates/app/assets/javascripts/angular_app.js.coffee.erb
happy_seed-0.0.18 lib/generators/happy_seed/angular_install/templates/app/assets/javascripts/angular_app.js.coffee.erb
happy_seed-0.0.17 lib/generators/happy_seed/angular_install/templates/app/assets/javascripts/angular_app.js.coffee.erb