I have an angular app. And I'm using cascading combobox (country-state) in below example. But, get states()
method in state.component.ts
running a lot of time. What can be the reason of this? I want run only country selection changed. I put debugger
. You can reproduce bug by open console with F12. If my method mistake, I can change completely my way.
相关问题
- Angular RxJS mergeMap types
- void before promise syntax
- npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fs
- Ignore Typescript errors in Webpack-dev-server
- How to update placeholder text in ng2-smart-table?
相关文章
- angular脚手架在ie9+下兼容问题
- angular 前端项目 build 报错 "Cannot find module 'le
- Cannot find module 'redux' 怎么解决?
- Angular Material Stepper causes mat-formfield to v
- After upgrade to Angular 9 cannot find variable in
- is there any difference between import { Observabl
- Suppress “Circular dependency detected” suppress w
- How can you get current positional information abo
When you use a getter, this happens several times alog life of component.
You must change your aproach. One way is subscribe to valueChanges of the form, and change "states" in the subscribe. Some like
You component.html must be reference to _studentForm
Your forked stackblitz
Update Well, with the vision of the whole problem, perhafs it's time to create a Component that control country and states at time. it's some more complex beacuse we must use viewProviders and FormGroupDirective.
The idea, pass as argument to the component the name of the controls (countryID and StateID) and the label of the controls (countryLabel and stateLabel)
The new component becomes as
The .html
And the use
The forked stackblitz