Set custom data- attributes on {{#linkTo}} helper tag

后端 未结 2 1878
情话喂你
情话喂你 2020-12-29 05:52

How can I set custom data- attribute on the {{#linkTo}} helper? I want use this:

{{#linkTo \"foo\" data-toggle=\"dropdown\"}}foo{{/         


        
2条回答
  •  梦谈多话
    2020-12-29 06:38

    @intuitivepixel

    Thanks

    U helped a lot. With that Information I've played arround with the LinkView and was able to find a generic solution:

    Em.LinkView.reopen({
        init: function() {
            this._super();
            var self = this;
            Em.keys(this).forEach(function(key) {
                if (key.substr(0, 5) === 'data-') {
                    self.get('attributeBindings').pushObject(key);
                }
            });
        }
    });
    

提交回复
热议问题