Inject $uibModalInstance to a controllar not initiated by a $uibModal

后端 未结 3 447
猫巷女王i
猫巷女王i 2020-12-09 23:13

I have these two views:

1) foo.html

  

Hello {{name}}

2) foo-as-modal.html

3条回答
  •  执笔经年
    2020-12-09 23:57

    One way to do this is to resolve $uibModalInstance in the route with null (or an empty string/or whatever you please) and inject it into the controller. If the html page isn't opened as a modal, you still have $uibModalInstance. If it's opened as a modal, $uibModalInstance is automatically injected.

提交回复
热议问题