Angular 2 View will not update after variable change in subscribe

后端 未结 4 1657
耶瑟儿~
耶瑟儿~ 2020-11-27 04:26

I have a problem where my view will not change when I update my variable in my observable subscription. I am trying to show a loading spinner while I wait for a response fro

4条回答
  •  -上瘾入骨i
    2020-11-27 04:37

    You can switch (on/off) template updating via changeDetection. You have to put your choice of strategy into component definition. You can choose Default or OnPush strategy.

    @Component({
        selector: '...............',
        templateUrl: '.......html',
        styleUrls: ['..........scss'],
        changeDetection: ChangeDetectionStrategy.Default
    })
    

提交回复
热议问题