javascript - ember component based on model type -
I know that it has been repeated to some extent, but all attempts to create a dynamic component renderer can potentially lack my knowledge Due to the failures in Amber Concepts
My scenario is a multipurpose search bar that will search for the model in the cache. I have to provide every search result below the type of model search input i name the handlers file syntax My search template looks like this: And my attempt on a render. Finder Assistant looks like this: When this option runs. Model throws: I am batting my eyelids who are now trying to get this right is. Am I even asking for possible? Thank you in advance. I know that this is a year's question, but in amber dynamically rendering components Is new to component / app-search-& lt; Model-type-key & gt; With example .hbs will be done according to model type. The template name for the customer model should be
components / app-search-customer.hbs
& Lt; Div class = "well-MD" & gt; & Lt; Div class = "input-group" & gt; {{Input value = search term square = "form-control"}} & lt; / Div & gt; {{#if searchTerm}} & lt ;! - Updating search causes populating results with models - & gt; {{#if result.length}} & lt; Ul class = "list-group search-results" & gt; {{# Result result result}}
Ember.Handlebars.registerHelper ('renderSearchComponent', function (model, option) {var ModelType = options.model.constructor.typeKey, componentPath, component, helper ; If (typeof modelType === 'undefined') {componentPath = "app-search-default";} and {componentPath = "app-search-" ModelType;} component = Ember.Handlebars.get (this, component path, option ), Helper = Ember.Handlebars.resolveHelper (options.data.view.container, component); helper.call (this, option);});
TypeError: options.model is undefined as well as I have the following error:
Error: Taboo failure: Empty a view in InBuffer status Is not allowed and should not happen in normal circumstances. It is most likely that there is a bug in your application. It may be due to excessive property change notifications
{{# As each model | Post |}} {{! - Eu-component or bar-component -}} {{component post.componentName post = post}} {{/ each}}
Comments
Post a Comment