javascript - Why is extending an extended view not working in ember.js? -
i trying create modal view , have base class modals need , extending more specific functionality.
plansource.modal = ember.view.extend({ isshowing: false, hide: function() { this.set("isshowing", false); }, close: function() { this.set("isshowing", false); }, show: function() { this.set("isshowing", true); } }); plansource.addjobmodal = plansource.modal.extend({ templatename: "modals/add_job", createjob: function() { var container = $("#new-job-name"), name = container.val(); if (!name || name == "") return; var job = plansource.job.createrecord({ "name": name }); job.save(); container.val(""); this.send("hide"); } });
i render with
{{view plansource.addjobmodal}}
and have view template
<a class="button button-green" {{action show target=view}}>+ add job</a> {{#if view.isshowing}} <div class="modal-wrapper"> <div class="overlay"></div> <div class="dialog box box-border"> <div class="header"> <p class="title">enter job name.</p> </div> <div class="body"> <p>enter name new job.</p> <input type="text" id="new-job-name" placeholder="job name"> </div> <div class="footer"> <div class="buttons"> <a class="button button-blue" {{action createjob target=view}} >create</a> <a class="button" {{action close target=view}}>no</a> </div> </div> </div> </div> {{/if}}
the problem when click button on modal dialog, gives me "action createjob" can not found. extending objects incorrectly because works if put createjob in base modal class.
fixed
there issue somewhere else in code. name got copied , redefining , making method not exist.
Comments
Post a Comment