lundi 30 juillet 2018

dart: How to dynamically transfer data?

I want to make a modal window component. In order to be able to transfer it to the head, content, footer.

When you change the data, the changes do not occur in the template:

page.dart

ModalComponent MC = new ModalComponent()..init(mTitle:'TitleX');

modal.dart

class ModalComponent {
  String title = 'sss';
  Future init({String mTitle = 'title'}) async{
    this.title = mTitle;
    print(title);
  }
}

modal.html

...
<h4 class="modal-title"></h4>
...

In the template, I see "sss". In the console I see a print with "TitleX". Why is the data in the template not updated? In the template there is an inscription "sss".

How to correctly do what I want?




Aucun commentaire:

Enregistrer un commentaire