Quantcast
Channel: Ionic Forum - Latest posts
Viewing all articles
Browse latest Browse all 228595

How to pass data from $ionicModal to main controller?

$
0
0

In my case.. I could update the data from cannot be bind on the main view... is there something wrong with my code ?
Main Controller

$ionicModal.fromTemplateUrl('post-modal.html', {
        scope: $scope,
        animation: 'slide-in-up'
    }).then(function (modal) {
        $scope.modal = modal;
    });

Modal Controller
$scope.save = function () {
console.info('Save');
$scope.announcements.push(
{
id: $scope.announcements.length+1,
name: 'April Marie Bandivas',
content: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ipsa nobis ullam, aliquam illum reiciendis velit architecto a quisquam, perspiciatis eum excepturi delectus optio. Labore, inventore fuga, itaque molestiae ex dignissimos.',
files: [
{
id: 1,
file: 'sansa-snowcastle.png',
type: 'image',
}
],
avatar: 'tyrion.jpg',
comments: 120,
time: 'Just now'
}
);
$scope.modal.hide();
console.info($scope.announcements);
};

the code was successfuly executed and updated the $scope.announcement from the main controller.. however it wont display the new data on the view..


Viewing all articles
Browse latest Browse all 228595

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>