Question

i am trying to bind values and observe from an extended class in dart, but somehow it is not working.

class Item extends ObservableBase {
  @observable String subject;

  Item(this.subject);
}

class TopItem extends Item {  
  TopItem(String subject):super(subject);
}

Using this binding not working:

topItem = new TopItem("subject");
<input type="text" value="{{topItem.subject}}"/>

If I use Item it is working fine. What am I doing wrong here?

thanks a lot

Was it helpful?

Solution

This is a bug.

The question was answered by John Messerly on the Web UI mailing list (see https://groups.google.com/a/dartlang.org/d/msg/web-ui/WRLhW8fIm_E/FGdtvvnADT4J).

You can read about the bug at:

https://github.com/dart-lang/bleeding_edge/blob/master/dart/pkg/observe/lib/src/observable.dart#L117

Once the bug is fixed, I'll update the answer here.

OTHER TIPS

I was able to get your example working by changing the HTML to:

<template id="tmplsubject" bind>
Subject : <input type="text" value="{{subject}}"/>
</template>

With the model being defined as:

query('#tmplsubject').model = new TopItem("Dart");

This was using Dart SDK r27268.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top