0

コレクション内のモデルごとに、モーダル、具体的にはhttp://awkward.github.io/backbone.modal/を含めようとしています。

最初にハンドルバーのテンプレートを試してみましたが、うまくいきませんでした。_underscore を使用するためのものかどうかわからないので、変更しましたが、なぜ機能しないのかわかりません。

レンダリングされたモデルのクリックで実行されるビューで使用する関数は次のとおりです。

detalleProducto : function(event){
        var id = $(event.currentTarget).data('id');
        var item = this.collection.get(id);

        var templt = _.template("<div class='bbm-modal__topbar'>\
                <h3 class='bbm-modal__title'> <%= item.nombre %> </h3>\
            </div>\
            <div class='bbm-modal__section'>\
                <img src='img/modal/ <%= item.imagen %>' />\
                <p><%= item.descripcion %></p>\
                <p><%= item.presentacion %></p>\
            </div>\
            <div class='bbm-modal__bottombar'>\
            <a href='#' class='bbm-button'>Close</a>\
            </div>"
        );
        var tmpl = templt({item: item.attributes}); 

        var Modal = Backbone.Modal.extend({
            template: tmpl,
            cancelEl: '.bbm-button'
        });

        var modalView = new Modal();
        $('#app').html(modalView.render().el);

    },

コンソールには Uncaught TypeError: Property 'template' of object [object Object] is not a function. と表示されます。

それで、多分私はテンプレートを正しく渡していませんか?? 私はすべてまたはあなたの助けに感謝します. ありがとう...

4

0 に答える 0