Expression ___ has changed after it was checked

后端 未结 17 2086
太阳男子
太阳男子 2020-11-22 05:53

Why is the component in this simple plunk

@Component({
  selector: \'my-app\',
  template: `
I\'m {{message}}
`, }) export class App {
17条回答
  •  滥情空心
    2020-11-22 06:12

    I think a most simple solution would be as follows:

    1. Make one implementation of assigning a value to some variable i.e. via function or setter.
    2. Create a class variable (static working: boolean) in the class where this function exists and every time you call the function, simply make it true whichever you like. Within the function, if the value of working is true, then simply return right away without doing anything. else, perform the task you want. Make sure to change this variable to false once the task is completed i.e. at the end of the line of codes or within the subscribe method when you are done assigning values!

提交回复
热议问题