Reputation: 13
How do i pass a data from a call to load a modal i.e this var c so i can use it on my controller to use it on my query
$scope.compareMe = function(Data) {
console.log($scope.cannedLst.name)
var c = $scope.cannedLst.name;
$scope.Data = c;
$scope.modal.show();
}
Upvotes: 1
Views: 61
Reputation: 10003
In the controller that uses you $ionicModal you can pass the data as a scope variable
//your main controller
.controller('MyController', function($scope, $ionicModal) {
//you function to get data and call modal
$scope.compareMe = function(Data) {
console.log($scope.cannedLst.name)
var c = $scope.cannedLst.name;
//this is the data we're passing
$scope.Data = c;
$scope.modal.show();
}
//modal configuration (may be 'templateString')
$ionicModal.fromTemplateUrl('my-modal.html', {
//here it states that inside the modal $scope will be == data you've passed
scope: $scope.Data,
animation: 'slide-in-up'
}).then(function(modal) {
$scope.modal = modal;
});
Upvotes: 1