ember-addons / bootstrap-for-ember

Bootstrap for Ember.js
http://ember-addons.github.io/bootstrap-for-ember
Apache License 2.0
704 stars 103 forks source link

Uncaught TypeError: Cannot call method 'set' of null #102

Closed davidsteinberger closed 10 years ago

davidsteinberger commented 10 years ago

I'm having issues using the modal component w/ footerbuttons (programatically) w/ ember 1.6.

The problem seems to be the init method on the ButtonComponent:

init: ->
        @_super()
        #If content is an object, then assign its properties to the button component
        if @get('content')? and Ember.typeOf(@get('content')) is 'instance'
            for key,val of @get('content')
                @set key, val
        else
            if not @get('title')?
                @set('title', @get('content'))
            @attributeBindings.pushObject attr for attr of @ when attr.match(/^data-[\w-]*$/)?

When I change the for loop in the following way it assigns all relevant properties and behaves as expected:

    for key,val of @get('content')
                @set key, val if key? and key != 'constructor'

Shall the constructor object be really assigned (shallow copy)?

asaf commented 10 years ago

Nope it should be skipped,

I already encountered this issue and ill send a patch in few hours.

Asaf.

davidsteinberger commented 10 years ago

Thanks for confirming!