Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Angle-bracket components #19

Closed
theharq opened this issue May 19, 2015 · 0 comments
Closed

Angle-bracket components #19

theharq opened this issue May 19, 2015 · 0 comments

Comments

@theharq
Copy link

theharq commented May 19, 2015

Hi there,

After this PR was merged emberjs/ember.js#11141

which introduced these changes:

  1. Attributes specified as strings (with “quotation marks”) are inserted into the DOM as attributes. For the most part, this eliminates the need for attributeBindings.
  2. Angle bracket components do not support attrs at the top-level (the entire attrs proxy functionality is disabled).

I had to fix some components to read the params from this.attrs instead using this.get

// ember-ionic/addon/components/ion-header.js

import Ember from 'ember';

export default Ember.Component.extend({
  tagName: 'ion-header',
  classNames: ['bar', 'bar-header'],
  classNameBindings: ['kindClass'],

  kindClass: Ember.computed('kind', function() {
    let kind = this.attrs.kind;
    if (kind) {
      return `bar-${kind}`;
    }
  })
});

With this change I could use the component in this form:

{{#ion-header kind=test}}<div class="h1 title">Header</div>{{/ion-header}}

Renders: (good)

<ion-header kind="balanced"><div class="h1 title">Header</div></ion-header>

But using the angle-bracket form:

<ion-header id="ember447" class="ember-view bar bar-header bar-balanced">
  <div class="h1 title">Header</div>
</ion-header>

Renders: (bad)

<ion-header id="ember446" kind="balanced" class="ember-view bar bar-header">
  <div class="h1 title">Header</div>
</ion-header>

which returns the kind argument as an attribute..so I guess the only valid way ( unless you don't use any argument ) is without the angle-bracket form, for now

@theharq theharq closed this as not planned Won't fix, can't repro, duplicate, stale Oct 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant