Search code examples
javascriptruby-on-railsbackbone.jscoffeescript

Cannot define two events in backbone view


I had this working code with one event in backbone but now I need to have two events defined. But I am having ExecJsProgramError. I would appreciate if someone could tell me what I am doing wrong in the following code?

     class Hcm.Views.GlobalHeader extends Backbone.View
      template: JST["backbone/templates/global/header"]
      id: "header"

      events: ->
        "submit #sign-in": "update" 
        "click .fb-login": "login_with_facebook"

      render: ->
        $(@el).html(@template())
        return this

      login_with_facebook: (e)  ->
       alert 'ghanta prajeep'

Solution

  •     events:
         "click a#showlogin": "showLogin"
         "click input#login": "login"
    

    So this is what I needed to do.