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

pdb_ember: Ember hello world #12

Open
mrjmd opened this issue Apr 8, 2016 · 5 comments
Open

pdb_ember: Ember hello world #12

mrjmd opened this issue Apr 8, 2016 · 5 comments
Assignees

Comments

@mrjmd
Copy link
Owner

mrjmd commented Apr 8, 2016

Let's evaluate what it will take to get a basic hello world module / example component out there in Ember.

@kepford
Copy link
Collaborator

kepford commented Apr 27, 2016

I'm totally new to Ember.js but it appears to expect to control the complete page. I did a bit of Googling and it also appears you can set the root element. That said, I have a few questions to consider:

  • When using Ember in multiple blocks on a single page even possible?
  • Would each block be it's own app?
  • Could multiple blocks be aware of each other?

@kepford
Copy link
Collaborator

kepford commented May 2, 2016

Setting the root element is as easy as this.

App = Ember.Application.extend({
  rootElement: "emberexample1",
});

This will tell Ember to attach its application to a tag named <emberexample1>.

@kepford
Copy link
Collaborator

kepford commented May 2, 2016

What I'm trying to figure out is what we should render from Drupal and what should be added to the page by Ember. Most examples I find use <script> tags to allow Handlebars.js to populate the area of the page with content from the Ember templates.

I believe we could include a template file in the Ember example that would output the script tags, but this seems to Drupal specific. Now the Front end developer needs to use Twig.

I'm trying to learn more about Ember and how it builds a page to determine what the best method would be.

@kepford
Copy link
Collaborator

kepford commented May 2, 2016

Acourding to the Ember docs on templating if you aren't using build tools it's cool to use script tags. This seems like it would be a problem though with Twig.

    <script type="text/x-handlebars">
      Hello, <strong>{{firstName}} {{lastName}}</strong>!
    </script>

Handlebars uses {{variable}} as Twig does.

@kepford
Copy link
Collaborator

kepford commented May 2, 2016

Pushed my work in progress branch.
https://github.com/mrjmd/pdb/tree/feature/12-Ember-Hello-World

@mrjmd mrjmd changed the title Ember hello world pdb_ember: Ember hello world May 27, 2016
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

2 participants