替换List中的项会导致AngularDart中的NotFoundError

时间:2014-10-23 08:02:58

标签: dart angular-dart

如果我点击<a class="replace" href="#" ng-click="replace(musician.lastname)">[ REPL ]</a>

,就会调用

“replace”

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");
    });
}

如果index为0(第一个),它可以正常工作,但与其他所有其他方法一起失败:

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(替换功能) GH:http://goo.gl/4FfYlo(AppController)

这是JS版本:http://www.mikemitterer.at/fileadmin/sourcesamples/accordion/(相同结果)

在我的示例中,如果您将“Mozart”替换为“Tina Turner”,它可以正常工作,但如果您将“Mercury”替换为TT则会失败......

0 个答案:

没有答案