Angular-ui modal - pass data into modal

前端 未结 3 1865
终归单人心
终归单人心 2021-01-01 15:18

I am trying to pass some model data into a modal window when it is opened. When the user clicks on an element I want to have the modal window open and display more detailed

3条回答
  •  -上瘾入骨i
    2021-01-01 15:52

    What worked for me was to create an object within resolve that returns an object that holds the variables that I wanted to share.

    resolve: {
      shared: function(){
        return {
          name: 'Spencer',
          numbers: [1, 2, 3]
        }
      }
    }
    

    To access the shared object, include it when defining your modal instance controller.

    app.controller('ModalInstanceController', function($scope, shared, $uibModalInstance,

提交回复
热议问题