Angular-ui modal - pass data into modal

mcneela86 picture mcneela86 · Nov 5, 2014 · Viewed 45.5k times · Source

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 information relating to what was clicked on.

I have created a plunker that works how I want it to except for passing the data into the modal window.

I am trying to pass the data in using ng-click:

<img ng-src="{{item.picture}}" width="100" ng-click="open(item)"/>

Can anyone help me with this? or point me in the right direction?

Answer

Mati Tucci picture Mati Tucci · Nov 5, 2014

How about this?

I added the item to the resolve

resolve: {
    items: function () {
        return $scope.items;
    },
    item: function(){
        return size;
    }
}

And in the controller I am doing: $scope.item = item; after injecting the item