angular ui modal can NOT refer to parent scope

后端 未结 3 1840
悲哀的现实
悲哀的现实 2021-02-08 03:21

i am using angular ui modal to create modal in my project.

Everything works fine until I need to refer to variable in parent scope. see plunker code

It seems lik

3条回答
  •  南旧
    南旧 (楼主)
    2021-02-08 03:53

    Angular UI's modals use $rootScope by default (See the documentation here).

    You can pass a scope parameter with a custom scope when you open the modal – e.g. scope: $scope if you want to pass the parent scope. The modal controller will create a sub-scope from that scope, so you will only be able to use it for your initial values.

提交回复
热议问题