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 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

My search template looks like this:

  & 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}}   

And my attempt on a render. Finder Assistant looks like this:

  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);});   

When this option runs. Model throws: 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   

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

  {{# As each model | Post |}} {{! - Eu-component or bar-component -}} {{component post.componentName post = post}} {{/ each}}    

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -