问题
"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