0
votes

I have this minimal code for an Angular Dart component, I've even written it in the same file, but I cant get it to work.

import 'package:angular/angular.dart';
import 'package:angular/application_factory.dart';

void main() {

    applicationFactory().addModule(new TT()).run();

}

class TT extends Module
{
    TT ()
    {
        bind(SimpleString);
    }
}


@Component(
    selector: 'simplestring',
    publishAs: 'cmp',
    template: '<div> {{cmp.str}} </div>'
)
class SimpleString
{
    @NgAttr('str')
    String str;
}

Html body

<body>
    <simplestring str='hola'></simplestring>
</body>

This should show "hola", but nothing is happening.

1

1 Answers

1
votes

publishAs:is deprecated and not interpreted any more since AngularDart 1.0

Use the property name directly:

@Component(
    selector: 'simplestring',
    template: '<div> {{str}} </div>'
)
class SimpleString
{
    @NgAttr('str')
    String str;
}