Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9024993
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T06:09:45+00:00 2026-06-16T06:09:45+00:00

I’ve been following the Dart web-ui codelab. When I embed dart source code inside

  • 0

I’ve been following the Dart web-ui codelab. When I embed dart source code inside a web component .html file, I’m not getting any static analysis or autocomplete support in the Dart Editor (there’s an open bug for this http://code.google.com/p/dart/issues/detail?id=7449 ). Hence, I’m looking for a temporary workaround by using the src attribute.

According to the spec, the src attribute is supported for web components in Dart:
https://www.dartlang.org/articles/dart-web-components/spec.html#behavior. I tried linking to an external Dart library: given a foo.html web component for

<element name="x-foo-component" constructor="FooComponent" extends="div">

I’d like to link to a separate foo_embed.dart file in the same directory as my web component, which defines FooComponent, by adding:

<script type="application/dart" src="foo_embed.dart"></script>

within foo.html. Following the spec’s suggestions, foo_embed.dart needs to be a Dart library, and would contain:

library foo_embed;
import 'package:web_ui/web_ui.dart';
class FooComponent extends WebComponent {
    ...
}

When I try this, running build.dart (from these instructions http://www.dartlang.org/articles/dart-web-components/tools.html) ends up only putting foo_embed.dart in out/ and there’s no out/foo.html.dart generated for importing in application.dart.

As expected, pasting the contents of foo_embed.dart as an inline script inside foo.html directly (as done in the codelab) works with build.dart, and I can launch my webapp in Dartium, so I don’t seem to have any other syntax problems in my project.

Do I probably have a simple syntax mistake somewhere? Or is this a temporary limitation of the Dart web components compiler? Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T06:09:46+00:00Added an answer on June 16, 2026 at 6:09 am

    I can’t reproduce your problem.

    This works for me:

    lib/foo.dart

    library foo;
    
    import 'package:web_ui/web_ui.dart';
    
    class FooComponent extends WebComponent {
      var foo = 'asddfg';
    }
    

    lib/foo.html

    <element name="x-foo" constructor="FooComponent" extends="div">
      <template>
        <input value="{{ foo }}" />
      </template>
      <script type="application/dart" src="foo.dart"></script>
    </element>
    

    example/test.html

    <!DOCTYPE html>
    <html>
      <head>
        <meta charset="utf-8">
        <link rel="components" href="packages/foo/foo.html" />
      </head>
      <body>
        <x-foo></x-foo>
    
        <script type="application/dart">main() {}</script>
        <script type="text/javascript" src="https://dart.googlecode.com/svn/branches/bleeding_edge/dart/client/dart.js"></script>
      </body>
    </html>
    

    Then I open up Dartium and go to .../example/out/test.html and I see an input with the data bound to it properly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
Is it possible to replace javascript w/ HTML if JavaScript is not enabled on
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I have a jquery bug and I've been looking for hours now, I can't
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want use html5's new tag to play a wav file (currently only supported

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.