Template layout does not work with component

I have a template that starts its definition with:

App.PasswordInputComponent = Ember.TextField.extend({
    templateName: 'templates/components/text-input-component',
    layoutName: 'templates/components/text-input-layout',

Without these two properties, he will select the default template for the component, which is “templates / components / password entry”. What is surprising (read: disappointing) is that it really loads this default value and ignores both parameters!

The documentation states that these two properties should behave the same as for the parent class View, but this is not my experience. Can someone tell me if they have this job?

+4
source share
3 answers

I found that if you specify:

templateName: 'components/text-input-component'

, handlebars :

{{text-input-component}}

:

{{password-input}}

, .

+2

, , :

App.MyFirstComponent = Ember.Component.extend({
    title: 'Hello'
});

components/my-first, :

{{title}} World

, , :

App.MySecondComponent = App.MyFirstComponent.extend({
    layoutName: 'components/my-first',
    title: 'Goodbye, Cruel'
});

:

{{my-first}} // output: Hello World

{{my-second}} // output: Goodbye, Cruel World
+1

layoutName , Handlebars , . , layoutName.

: https://github.com/emberjs/ember.js/commit/6f6247f54e1f2b841f73dedd274e962b3703ca1d

In the component that transmitted the block when called (in the rudder pattern) it is interpreted as its pattern, and the pattern that was registered as components/my-componentbecomes its layout.

and API documents: http://emberjs.com/api/classes/Ember.ComponentTemplateDeprecation.html

0
source

All Articles