小编Aug*_*ers的帖子

Backbone将模型传递给Router

我正在使用require js和Backbone开发一个Android应用程序.我必须通过touchend事件将一个从集合中获取的模型传递给路由器.我该怎么做?

define(["jquery", "underscore","backbone","handlebars", "views/CinemaView", "models/CineDati",  "text!templates/listacinema.html"],

function($,_,Backbone,Handlebars,CinemaView, CineDati, template){   
  var ListaCinemaView = Backbone.View.extend({
    template: Handlebars.compile(template),
    events: {
        "touchend" : "Details"
    },  
    initialize : function (){
        var self = this;
        $.ajax({
            url: 'http://www.cineworld.com/api/quickbook/cinemas',
            type: 'GET',
            data: {key: 'BwKR7b2D'},
            dataType: 'jsonp', // Setting this data type will add the callback parameter for you
            success: function (response, status) {
                // Check for errors from the server
                if (response.errors) {
                    $.each(response.errors, function() {
                        alert('An error occurred. Please Try Again');
                    });
                } else { …
Run Code Online (Sandbox Code Playgroud)

backbone.js

8
推荐指数
2
解决办法
9082
查看次数

标签 统计

backbone.js ×1