Replacing an item in List causes NotFoundError in AngularDart

ぐ巨炮叔叔 提交于 2019-12-11 11:32:59

问题


"replace" is called if I click on <a class="replace" href="#" ng-click="replace(musician.lastname)">[ REPL ]</a>

void replace(final String lastname) {
    _zone.run(() {

        final Address addressFromList = _model.musicians.firstWhere((final Address address) => lastname == address.lastname);
        final int index = _model.musicians.indexOf(addressFromList);

        _logger.info("Replace $lastname (Index: $index)");
        _model.musicians[index] = new Address("Tina","Turner");
    });
}

if index is 0 (first one) it works but fails with all others:

NotFoundError: The node before which the new node is to be inserted is not a child of this node.

STACKTRACE:
#0      BlinkNode.insertBefore_Callback_Node_Node (dart:_blink:270)
#1      Node.insertBefore (dart:html:23205)
#2      Node.insertAllBefore (dart:html:22868)
#3      domInsert (package:angular/core_dom/dom_util.dart:25:25)
#4      Animate.insert (package:angular/core_dom/animation.dart:44:19)
#5      ViewPort.insert.<anonymous closure> (package:angular/core_dom/view.dart:75:22)
...

GH: http://goo.gl/kOeAkc (replace function) GH: http://goo.gl/4FfYlo (AppController)

Here is the JS Version: http://www.mikemitterer.at/fileadmin/sourcesamples/accordion/ (Same result)

In my sample, if you replace "Mozart" with "Tina Turner" it works but if you replace "Mercury" with TT it fails...

来源:https://stackoverflow.com/questions/26523654/replacing-an-item-in-list-causes-notfounderror-in-angulardart

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!