Error: [$rootScope:infdig] 10 $digest() iterations reached. Aborting (match operator)

Error: [$rootScope:infdig] 10 $digest() iterations reached. Aborting (match operator)

我不断收到以下错误:

Error: [$rootScope:infdig] 10 $digest() iterations reached. Aborting! Watchers fired in the last 5 iterations:

[[{"msg":"person.kind.match('customer')","newVal":["customer"],"oldVal":["customer"]}],[{"msg":"person.kind.match('customer')","newVal":["customer"],"oldVal":"<>"}],[{"msg":"person.kind.match('customer')","newVal":["customer"],"oldVal":"<>"}],[{"msg":"person.kind.match('customer')","newVal":["customer"],"oldVal":"<>"}],[{"msg":"person.kind.match('customer')","newVal":["customer"],"oldVal":"<>"}]]

导致此问题的代码如下:

%p{ng: {if: "person.kind.match('partner')" } } Some text
.btn{ ng: { if: "person.kind.match('customer')" } } Some other text
  //more button here

我查看了现有的问题,发现它们都不一样。我的问题是由匹配运算符引起的。我如何在这里使用测试运算符。

注意:我不会在渲染视图期间更改 objects/models。我只是在使用匹配运算符

因此,似乎匹配运算符正在改变 person.kind 导致 10 $digest() iterations reached 错误。我更改了我的实现以使用 includes 函数而不是 match 运算符来解决问题。