Reputation: 11
place is a object. create-itinerary is directive . I open $ubiModal within a template pass create-itinerary directive and try to pass an object place.But in directive i got [object object].please help me.
$scope.showCreateItinerary = function(place) {
var tpl = '<div create-itinerary trip-details="\'' + place + '\'"></div>';
$uibModal.open({
animation: true,
ariaLabelledBy: 'modal-title',
ariaDescribedBy: 'modal-body',
template: tpl,
controller: 'ModalCtrl',
size: 'lg',
backdrop: 'static',
windowClass: "signup-popup abc"
});
};
Upvotes: 1
Views: 357
Reputation: 18392
Try to use resolve
param:
$scope.showCreateItinerary = function(place) {
$uibModal.open({
animation: true,
ariaLabelledBy: 'modal-title',
ariaDescribedBy: 'modal-body',
template: '<div create-itinerary trip-details="place"></div>',
controller: 'ModalCtrl',
size: 'lg',
backdrop: 'static',
windowClass: "signup-popup abc",
resolve: {
data: function () {
return {
place: place
}
}
}
});
};
app.controller('ModalCtrl', function($scope, $modalInstance, data) {
$scope.place = data.place;
});
Upvotes: 1