Undefined outlet?


#1

I’m trying to add a couple of buttons to the status bar, and I’m using a view created like this:

@content: ->
    @div class: 'inline-block', =>
      @span =>
        @div class: 'inline-block', =>
          @button class: 'btn btn-xs icon icon-git-commit', outlet: 'firstOutlet', click: 'doStuff'
        @div class: 'inline-block', =>
          @div class: 'text-success', outlet: 'secondOutlet', click: 'doOtherStuff'

initialize: (serializeState) ->
  atom.config.observe 'myPackage.myConfigThingOne', (newValue) =>
    barText = ' New value on ' + newValue
    @firstOutlet.text barText

  atom.config.observe 'myPackage.myConfigThingTwo', (newValue) ->
    barText = ' New value on ' + newValue
    @modeIndicator.text barText

I used to have only one element in the status bar (firstOutlet), and it worked great. I was also able to change the configuration value by clicking on the element.
Thing is, I added the second element to the status bar (it’s a div, still I got the same error also with a button) and it does not work anymore. Specifically, I get an error when I try to set the text of the element with the second outlet.

**Atom Version**: 1.1.0
**System**: Mac OS X 10.11.1

### Stack Trace
...
At Cannot read property 'text' of undefined

If I comment out that line (or, that observe method) everything works fine again.
Does anybody have an idea about why this is happening?
Thank you guys.


#2

Sorry, that’s my bad. I just realised my arrow should get some weight.


#3

Hi, how did you solve this problem?


#4

The second atom.config.observe call should use a fat arrow => rather than a skinny arrow ->.


#5

Oh yes, @leedohm is right. I should have specified that when I said that the arrow should get some weight :smiley: