Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ember.js/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Twitter bootstrap 使用Ember JS模板的引导工具提示,保留绑定_Twitter Bootstrap_Ember.js_Twitter Bootstrap Tooltip - Fatal编程技术网

Twitter bootstrap 使用Ember JS模板的引导工具提示,保留绑定

Twitter bootstrap 使用Ember JS模板的引导工具提示,保留绑定,twitter-bootstrap,ember.js,twitter-bootstrap-tooltip,Twitter Bootstrap,Ember.js,Twitter Bootstrap Tooltip,我正在使用引导工具提示显示绑定到Ember对象的表单 我可以让表单显示得很好,但我一辈子都不知道如何保持(双向)绑定工作 以下是我正在使用的代码: 预订。hbs <div> <span>{{lastName}}</span> <span>{{firstName}}</span> </div> {{view App.ReservationFormView}} <form class="reservation-

我正在使用引导工具提示显示绑定到Ember对象的表单

我可以让表单显示得很好,但我一辈子都不知道如何保持(双向)绑定工作

以下是我正在使用的代码:

预订。hbs

<div>
  <span>{{lastName}}</span>
  <span>{{firstName}}</span>
</div>

{{view App.ReservationFormView}}
<form class="reservation-form form-horizontal" role="form">
  <label>First Name</label>
  {{input type="text" value=firstName }}

  <label>Last Name</label>
  {{input type="text" value=lastName}}
</form>
App.ReservationFormView = Em.View.extend({
    templateName: 'reservationForm',
    classNames: ['hidden'],
    didInsertElement: function() {
        this.$().closest(".gf-sticker").tooltip({
            title: return this.$().html(),
            html: true,
            placement: 'auto',
            trigger: 'click'
        });
    }
});
我不太了解Ember,但当模板作为html传递时,我觉得数据绑定丢失了:
this.$().html()

这有什么办法吗


编辑:这里是小提琴:

当您调用
this.$().html()
时,您实际上是在复制视图的渲染html并将其插入工具提示。是的,所有绑定都会丢失,因为进入工具提示的副本不再由视图对象管理


不幸的是,引导工具提示API似乎无法在不复制HTML的情况下将现有元素显示为工具提示。

如果在emberjs.jsbin.com中共享此代码,效果会更好。。是否希望工具提示标题的内容在ReservationView中为HTML?这就是我读这篇文章的方式,但是将
表单作为工具提示的标题似乎不正确。但是它确实有效。。。检查小提琴。然而,我不明白为什么,也不能让它在我真正的项目中工作。