小编JAB*_*ABD的帖子

如何在骨干中的动态生成按钮上绑定事件?

如何在backbone.js中的动态生成按钮上绑定click事件?

 window.PackageView = Backbone.View.extend({

    tagName: "div",

    className: "package-template",

    events:{
      'click #display-nodes'  :  'main', // This button is declared in my HTML code and calls main method successfully.
      'click .display'        :  'disp', // This is dynamic button generated with class as display
    },

    getAction: function(nodeId){ // Get Actions from NodeId and generate buttons
      $('.nodes').append("<button>" + action.Name + "</button>"); //Generate Buttons
      $(".nodes button").addClass("display");
    },

    disp: function(){
        alert("Inside Disp Function");
    },
Run Code Online (Sandbox Code Playgroud)

单击#display-nodes节点时,将根据需要显示但.display不起作用.如何让这个按钮调用该功能?

javascript jquery backbone.js underscore.js

18
推荐指数
1
解决办法
1万
查看次数

如何使用zend导入CSV

如何使用zend框架导入CSV文件?我应该使用zend_file_transfer还是有任何我必须研究的特殊类?另外如果我使用zend_file_transfer是否有任何特殊的CSV验证器?

php csv zend-framework

12
推荐指数
2
解决办法
2万
查看次数

如何使用Backbone Router处理此错误?

这是我的application.js文件

window.App = {
init: function() {
     this.router = new PackageViewer();
       Backbone.history.start();
   }

};
Run Code Online (Sandbox Code Playgroud)

这是调用其他packageviewer.js

window.PackageViewer = new Backbone.Router.extend({
 routes : {
   '':'home'
},

initialize:function(){
   this.collection = new Package();
},

home:function(){
   $('body').append("<h1>Welcome</h1>");
 } 
});
Run Code Online (Sandbox Code Playgroud)

这是我的index.html的脚本标记 <body>

<script type="text/javascript"> 
$(document).ready(function (){            
    App.init();

});
</script>
Run Code Online (Sandbox Code Playgroud)

当我跑这个我得到 TypeError: 'undefined' is not a function (evaluating 'parent.apply(this, arguments)')

我无法理解这一点.救命!

javascript jquery backbone.js underscore.js

3
推荐指数
1
解决办法
4264
查看次数

量角器测试失败,因为模型值为空

我有一个样本小提琴,我试图用量角器测试.

以下是我的测试

describe("Fiddle homepage", function() {


    beforeEach(function() {
        browser.get('http://fiddle.jshell.net/yfUQ8/9/show');
        browser.rootEl = 'div';
    });
    describe("binding", function() {
        var inputByModel;
        beforeEach(function() {
            inputByModel = element(by.model('model.yourName'));
        })
        // Fail
        it("should have value Julie1", function() {
            inputByModel.sendKeys('Julie1');
            // browser.waitForAngular();
            expect(inputByModel.getText()).to.eventually.equal('Julie1');

        });
        // Fail
        it("should have value Julie2", function() {
            inputByModel.sendKeys('Julie2');

            var greeting = element(by.model('model.yourName'));
            expect(greeting.getText()).to.eventually.equal('Julie2');
        });
        // Pass
        it("should have value Julie3", function() {
            inputByModel.sendKeys('Julie3');
            var byBinding = element(by.binding('model.yourName'));
            expect(byBinding.getText()).to.eventually.equal('Julie');
        });
        // Fail
        it("should get value by id and should pass the …
Run Code Online (Sandbox Code Playgroud)

selenium integration-testing angularjs selenium-webdriver protractor

0
推荐指数
1
解决办法
2376
查看次数