2

I really like what I'm seeing with Web components in Dart. I had a look at the web page containing the different examples and would love to try it out.

If however I try any of the Samples on the page (like the helloworld example), by just pasting it in my dart editor, it just doesn't work. The TodoMVC app works, but it seems quite messy with all of those files just to run a one page app, and while serves as a good example of a fully working app, it's not a good starting point to learn.

Being a newbie in dart it's not very clear how I can start to use Web Components myself. What would be nice is if there was a very simple tutorial on the Web Components page, that shows you how to start from scratch to create a very simple app using web components.

Even the Hello World app would be good for this purpose.

Does someone have a good example of how to start with web components in dart?

1
  • Ok, so there was a extra page that has a list of tools and explains how to build your app for use with web components. This will help me get on for now, thought I still feel it would be a good idea to document somewhere that this extra step is required. Commented Oct 30, 2012 at 23:18

3 Answers 3

2

Did you read: http://www.dartlang.org/articles/dart-web-components/

See also: http://www.dartlang.org/articles/dart-web-components/tools.html

You can find the sample code here: https://github.com/dart-lang/dart-web-components

Updated: Seth wrote a nice blog post here: http://blog.sethladd.com/2012/11/your-first-web-component-with-dart.html

Sign up to request clarification or add additional context in comments.

4 Comments

First link yes. in my post I'm referring to the examples on that page. None of them work, which leads me to assume that there is some pre-requisite I'm missing, which is not documented there.
As for the second link, I'll have a read through that page now.
Ah, from your second link, it seems that web components needs to be compiled to actual JS before it works. It doesn't work as "plain" dart code in dartium, am I correct? If so, that's where I went wrong.
There are some special flags you need to pass to get it to work in Dartium.
1

I think your missing link is build.dart. See the section labeled "Editor background compilation" at http://www.dartlang.org/articles/dart-web-components/tools.html. As noted on that page, there are a few options to compile your Web Components, but I found build.dart the most straightforward.

This build.dart script interacts with some SDK components, so you'll want to be sure you've added the path to your system. On my OS X machine, I added this to my ~/.profile file:

export PATH=$PATH:/Users/dave/dart/bin

HTH!

Comments

1

I wrote a tutorial on getting started with web components using the Dart Web UI library. It is fairly basic and is a good place to start if you don't have much prior experience with web components. The tutorial can be read at:

http://shailen.github.com/blog/2012/12/31/a-first-app-with-web-components-using-dart/

The code, which you should download and run, lives at:

https://github.com/shailen/bookstore

Hope this helps.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.