Posted By: Anonymous
I am sure his must be a newbie question. In simple terms I wanted to define my first Polymer-dart component. Only I keep kicking my toe on the same speed-hump. To keep things very simple, I’ve stripped it back to a very simple example.
I did a simple rename of the example: ‘stopwatch‘component from the Dart component Polymer-dart tutorial:
I had errors similar to the one in the question title, so the renamed component is:
- ‘fred‘ … from: ‘tute-stopwatch‘
When this is done, I get the error trace below. It looks to me that the name is my problem. I confirmed this by running the example after each incremental change (what else can you do?). I retained the file names:
From the example, and only changed the component label name. That means a change in 3 x files.
- from: <tute-stopwatch></tute-stopwatch>
- <polymer-element name=”fred“>
- from: <polymer-element name=”tute-stopwatch”>
- <polymer-element name=”fred“>
- from: @CustomTag(‘tute-stopwatch’)
Although, I can’t say having to update three(3) things for one simple change is ideal, it is still very basic and very simple to ‘make‘ a new element with Polymer-dart once you have a model definition.
Apart from, what went wrong? I guess a second question I can ask is, what does the:
- ‘The type name is invalid.‘ … Mean?
The question is decidedly a newbie question. However because the ‘solution‘ is not obvious or intuitive, I’ve missed something. Oh and the error makes No Sense (to mere mortals). Muy gracias …
Uncaught Error: InvalidCharacterError: Registration failed for type 'fred'. The type name is invalid. Stack Trace: #0 _Utils._register (file:///E:/b/build/slave/dartium-win-full-stable/build/src/dart/tools/dom/src/native_DOMImplementation.dart:450) #1 _Utils.register (file:///E:/b/build/slave/dartium-win-full-stable/build/src/dart/tools/dom/src/native_DOMImplementation.dart:446) #2 HtmlDocument.register (file:///E:/b/build/slave/dartium-win-full-stable/build/src/build/Release/obj/global_intermediate/blink/bindings/dart/dart/html/HtmlDocument.dart:266) #3 PolymerDeclaration.registerType (package:polymer/src/declaration.dart:241:22) #4 PolymerDeclaration.register (package:polymer/src/declaration.dart:164:17) #5 PolymerDeclaration._register (package:polymer/src/declaration.dart:114:13) #6 PolymerDeclaration.registerWhenReady (package:polymer/src/declaration.dart:109:14) #7 _notifyType (package:polymer/src/declaration.dart:476:49) #8 Polymer.register (package:polymer/src/instance.dart:65:16) #9 _loadLibrary (package:polymer/src/loader.dart:196:25) #10 _loadLibraries (package:polymer/src/loader.dart:89:19) #11 _initPolymerOptimized (package:polymer/src/loader.dart:54:17) #12 _rootRun (dart:async/zone.dart:710) #13 _ZoneDelegate.run (dart:async/zone.dart:440) #14 _CustomizedZone.run (dart:async/zone.dart:650) #15 initPolymer (package:polymer/src/loader.dart:37:33) #16 main (package:polymer/init.dart:23:22) Exception: InvalidCharacterError: Registration failed for type 'fred'. The type name is invalid. undefined (undefined:0:0)
The tag name of polymer elements must contain a dash to differentiate them from standard DOM elements.