Hi - I am hoping this is a simple issue to resolve. I have a simple form (model driven) and I am writing a simple test using the testcomponentbuilder. When I call fixture.detectChanges() it throws an error, see below. Here is a link to the repository as well, it was created using angular-cli. https://github.com/bluefalcon/angular2-model-form-spec
My understanding is when you call fixture.detectChanges() for the first
time it will call ngOnInit(), which it does. Any changes you make after
such as, events fixture.detechChanges() it will update the component. I
have done so successfully on other components, but those were template
driven. The model driven forms are what are giving me an issue/headache so
far.
*Question: Is the the testcomponentbuilder the issue or something I did?
Any help is greatly appreciated.*
the issue is in setting.component.spec.ts.
snippet: try-catch is to capture error.
debugger;
try {
fixture.detectChanges();
} catch (e) {
debugger;
}
ORIGINAL EXCEPTION: No value accessor for 'settingName'
ORIGINAL STACKTRACE:
Error: No value accessor for 'settingName'
at new BaseException
(http://localhost:9876/base/dist/vendor/@angular/forms/src/facade/exceptions.js:27:23)
at _throwError
(http://localhost:9876/base/dist/vendor/@angular/forms/src/directives/shared.js:55:11)
at Object.setUpControl
(http://localhost:9876/base/dist/vendor/@angular/forms/src/directives/shared.js:30:9)
at FormGroupDirective.addControl
(http://localhost:9876/base/dist/vendor/@angular/forms/src/directives/reactive_directives/form_group_directive.js:71:18)
at FormControlName.ngOnChanges
(http://localhost:9876/base/dist/vendor/@angular/forms/src/directives/reactive_directives/form_control_name.js:39:32)
at DebugAppView._View_SettingComponent0.detectChangesInternal
(SettingComponent.template.js:198:55)
at DebugAppView.AppView.detectChanges
(http://localhost:9876/base/dist/vendor/@angular/core/src/linker/view.js:243:14)
at DebugAppView.detectChanges
(http://localhost:9876/base/dist/vendor/@angular/core/src/linker/view.js:348:44)
at DebugAppView.AppView.detectViewChildrenChanges
(http://localhost:9876/base/dist/vendor/@angular/core/src/linker/view.js:269:19)
at DebugAppView._View_SettingComponent_Host0.detectChangesInternal
(SettingComponent.template.js:37:8)
at DebugAppView.AppView.detectChanges
(http://localhost:9876/base/dist/vendor/@angular/core/src/linker/view.js:243:14)
at DebugAppView.detectChanges
(http://localhost:9876/base/dist/vendor/@angular/core/src/linker/view.js:348:44)
at ViewRef_.detectChanges
(http://localhost:9876/base/dist/vendor/@angular/core/src/linker/view_ref.js:131:65)
at ComponentFixture._tick
(http://localhost:9876/base/dist/vendor/@angular/core/testing/component_fixture.js:63:32)
at eval
(http://localhost:9876/base/dist/vendor/@angular/core/testing/component_fixture.js:77:49)
at ZoneDelegate.invoke
(http://localhost:9876/base/dist/vendor/zone.js/dist/zone.js?8b9c8d0a7e549abe9edec8da5a095f206d206277:323:29)
at AsyncTestZoneSpec.onInvoke
(http://localhost:9876/base/dist/vendor/zone.js/dist/async-test.js?8f51e44ce2093ec5167bc06760f15344db17d094:76:44)
at ZoneDelegate.invoke
(http://localhost:9876/base/dist/vendor/zone.js/dist/zone.js?8b9c8d0a7e549abe9edec8da5a095f206d206277:322:35)
at Object.onInvoke
(http://localhost:9876/base/dist/vendor/@angular/core/src/zone/ng_zone_impl.js:53:41)
at ZoneDelegate.invoke
(http://localhost:9876/base/dist/vendor/zone.js/dist/zone.js?8b9c8d0a7e549abe9edec8da5a095f206d206277:322:35)
at Zone.run
(http://localhost:9876/base/dist/vendor/zone.js/dist/zone.js?8b9c8d0a7e549abe9edec8da5a095f206d206277:216:44)
at NgZoneImpl.runInner
(http://localhost:9876/base/dist/vendor/@angular/core/src/zone/ng_zone_impl.js:84:71)
at NgZone.run
(http://localhost:9876/base/dist/vendor/@angular/core/src/zone/ng_zone.js:235:66)
at ComponentFixture.detectChanges
(http://localhost:9876/base/dist/vendor/@angular/core/testing/component_fixture.js:77:25)
at eval
(http://localhost:9876/base/dist/app/setting/setting.component.spec.js:31:29)
at F
(http://localhost:9876/base/dist/vendor/systemjs/dist/system-polyfills.js?a9f0c97e865a53da4c067b98cf2e65a23b2f0608:4:7484)
at H
(http://localhost:9876/base/dist/vendor/systemjs/dist/system-polyfills.js?a9f0c97e865a53da4c067b98cf2e65a23b2f0608:4:7116)
at q.when
(http://localhost:9876/base/dist/vendor/systemjs/dist/system-polyfills.js?a9f0c97e865a53da4c067b98cf2e65a23b2f0608:4:10790)
at b.run
(http://localhost:9876/base/dist/vendor/systemjs/dist/system-polyfills.js?a9f0c97e865a53da4c067b98cf2e65a23b2f0608:4:9826)
at t._drain
(http://localhost:9876/base/dist/vendor/systemjs/dist/system-polyfills.js?a9f0c97e865a53da4c067b98cf2e65a23b2f0608:4:1744)
at drain
(http://localhost:9876/base/dist/vendor/systemjs/dist/system-polyfills.js?a9f0c97e865a53da4c067b98cf2e65a23b2f0608:4:1398)
at MutationObserver.e
(http://localhost:9876/base/dist/vendor/systemjs/dist/system-polyfills.js?a9f0c97e865a53da4c067b98cf2e65a23b2f0608:4:3319)
at ZoneDelegate.invoke
(http://localhost:9876/base/dist/vendor/zone.js/dist/zone.js?8b9c8d0a7e549abe9edec8da5a095f206d206277:323:29)
at Zone.runGuarded
(http://localhost:9876/base/dist/vendor/zone.js/dist/zone.js?8b9c8d0a7e549abe9edec8da5a095f206d206277:230:48)
at MutationObserver.<anonymous>
(http://localhost:9876/base/dist/vendor/zone.js/dist/zone.js?8b9c8d0a7e549abe9edec8da5a095f206d206277:206:30)
ERROR CONTEXT:
[object Object]"
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.
