javascript - Angular2 Component inside ngFor throws Error (viewFactory is not a function) -
i have a componentb in angular 2 app (beta 1). works fine until place inside ngfor loop in componenta. receive rather cryptic error of:
exception: typeerror: viewfactory_componentb0 not function in [numbers in componenta@1:23]browserdomadapter.logerror @ angular2.dev.js:22690browserdomadapter.loggroup @ angular2.dev.js:22701exceptionhandler.call @ angular2.dev.js:1163(anonymous function) @ angular2.dev.js:12416ngzone._notifyonerror @ angular2.dev.js:13324collection_1.stringmapwrapper.merge.onerror @ angular2.dev.js:13228run @ angular2-polyfills.js:141(anonymous function) @ angular2.dev.js:13247ngzone.run @ angular2.dev.js:13209(anonymous function) @ angular2.dev.js:12499schedulerfn @ angular2.dev.js:12742trycatcher @ rx.js:31subscriber.next @ rx.js:9500subject._next @ rx.js:9999subject.next @ rx.js:9963eventemitter.emit @ angular2.dev.js:12723(anonymous function) @ angular2.dev.js:13140run @ angular2-polyfills.js:138ngzone._notifyonturndone @ angular2.dev.js:13139(anonymous function) @ angular2.dev.js:13254zoneboundfn @ angular2-polyfills.js:111lib$es6$promise$asap$$flush @ angular2-polyfills.js:1305 angular2.dev.js:22690 original exception: typeerror: viewfactory_componentb0 not functionbrowserdomadapter.logerror @ angular2.dev.js:22690exceptionhandler.call @ angular2.dev.js:1172(anonymous function) @ angular2.dev.js:12416ngzone._notifyonerror @ angular2.dev.js:13324collection_1.stringmapwrapper.merge.onerror @ angular2.dev.js:13228run @ angular2-polyfills.js:141(anonymous function) @ angular2.dev.js:13247ngzone.run @ angular2.dev.js:13209(anonymous function) @ angular2.dev.js:12499schedulerfn @ angular2.dev.js:12742trycatcher @ rx.js:31subscriber.next @ rx.js:9500subject._next @ rx.js:9999subject.next @ rx.js:9963eventemitter.emit @ angular2.dev.js:12723(anonymous function) @ angular2.dev.js:13140run @ angular2-polyfills.js:138ngzone._notifyonturndone @ angular2.dev.js:13139(anonymous function) @ angular2.dev.js:13254zoneboundfn @ angular2-polyfills.js:111lib$es6$promise$asap$$flush @ angular2-polyfills.js:1305 angular2.dev.js:22690 original stacktrace:browserdomadapter.logerror @ angular2.dev.js:22690exceptionhandler.call @ angular2.dev.js:1175(anonymous function) @ angular2.dev.js:12416ngzone._notifyonerror @ angular2.dev.js:13324collection_1.stringmapwrapper.merge.onerror @ angular2.dev.js:13228run @ angular2-polyfills.js:141(anonymous function) @ angular2.dev.js:13247ngzone.run @ angular2.dev.js:13209(anonymous function) @ angular2.dev.js:12499schedulerfn @ angular2.dev.js:12742trycatcher @ rx.js:31subscriber.next @ rx.js:9500subject._next @ rx.js:9999subject.next @ rx.js:9963eventemitter.emit @ angular2.dev.js:12723(anonymous function) @ angular2.dev.js:13140run @ angular2-polyfills.js:138ngzone._notifyonturndone @ angular2.dev.js:13139(anonymous function) @ angular2.dev.js:13254zoneboundfn @ angular2-polyfills.js:111lib$es6$promise$asap$$flush @ angular2-polyfills.js:1305 angular2.dev.js:22690 typeerror: viewfactory_componentb0 not function @ appelement.viewfactory_componenta1 [as embeddedviewfactory] (viewfactory_componenta:388) @ appviewmanager_.createembeddedviewincontainer (angular2.dev.js:9185) @ viewcontainerref_.createembeddedview (angular2.dev.js:5890) @ ngfor._bulkinsert (angular2.dev.js:14608) @ ngfor._applychanges (angular2.dev.js:14567) @ ngfor.ngdocheck (angular2.dev.js:14552) @ abstractchangedetector.changedetector_componenta_0.detectchangesinrecordsinternal (viewfactory_componenta:45) @ abstractchangedetector.detectchangesinrecords (angular2.dev.js:7825) @ abstractchangedetector.rundetectchanges (angular2.dev.js:7808) @ abstractchangedetector._detectchangesinviewchildren (angular2.dev.js:7892)
componenta:
@component({ selector: 'component-a' , directives: [ form_directives , componentb ] , template: ` <!-- works --><component-b [(ngformcontrol)]="_formcontrol"></component-b> <!-- fails --><component-b *ngfor="#number of numbers" [(ngformcontrol)]="_formcontrols[number]"></component-b> ` }) export class componenta {} any hints/help highly appreciated.
as suggested @tylerdurden
this error message produced bug introduced in cycle detection (see #6404).
there's fix in master (see #6474) not yet released. sure in beta.2.
the recommendation downgrade beta.0 until storm over.
update
this issue has been fixed in beta.2 (issues minification still there). see changelog more details.
Comments
Post a Comment