Angular JS: ng-click scope set doesn't work in ng-if

前端 未结 3 1989
长情又很酷
长情又很酷 2021-02-08 06:08

Today, I have seen a bug in angularjs:

When you try to set a scope value directly in a ng-click, it doesn\'t work when your ng-click is in a ng-if which test the same sc

3条回答
  •  抹茶落季
    2021-02-08 06:47

    I don't think this is a bug. You are just auto-creating properties and confusing scopes in the view.

    Updated Fiddler.

    This does work:

  • This is happening because self inside of the ng-if is creating a new scope.

提交回复
热议问题