javascript - Ember set belongsTo associantion works only first time -
This code should provide the user a screen to update the template of your portfolio.
In this screen the server always gives 5 templates and the portfolio already has a template associated.
Model Route Controller portfoloh.hbs This code works fine, while the user chooses a new template for the current portfolio. Example: But this Examples: In the previous three steps, the screen is not updated and console logs: that is, I am stuck in this bug. Any help? This is a bug in amber data that has been set in the master See my JSBin to reproduce the issue You can comment / simulate the version of amber data and re-issue that issue again. Can generate > Besides, I had to fix my code to make it work:
App.Portfolio = DS.Model.extend Color: DS.attr 'string' Template: DS.belongsTo 'template' App.Template = DS.Model.extend Title: DS.attr 'string' Portfolio: DS.hasMany ('template')
App.PortfolioRoute = Ember.Route.extend setupController: (Controller, Model) - & gt; This._super (controller, model); Load all the templates for the #Proplio Screen Controller. Templates, this.store.find 'template'
PortfolioApplication Portfolio Controller = Ember.ObjectController.extend Selected Template: Empty Examination Template Selection: (- & gt; @set 'model.template', @get ('selectedTemplate') console.log @get 'selectedTemplate' console.log @get ' Model 'console.log' -------- '.).'. ' Changes selected 'template actions: changeTemplate: (template) - & gt; @set 'selectedTemplate', template
{{# tmpl}} in all templates & lt; Button {{Action 'ChangeTemplate' tmpl}} & gt; {{Tmpl.title}} & lt; / Button & gt; {{/ Every}} & lt; H3 & gt; Template {{template.title}} & lt; / H3 & gt;
selectedTemplate.id = & Gt; 1 model.teplate.id = & gt; 2 --------
@set 'model.template', @get ('selectedTemplate') has not been updated < Code> template
property of portfolio
RSVP.hash to
templates To do
model hook in
portfolio you can set
store.find in
setupController
portfolio in
. In
templates the
template and
template and
templates .
needs
Comments
Post a Comment