Dropdown in the modal does not see scope of the controller Angular JS 1.5

0

Good morning.

The problem is this, I have a news feed page and inside it I use a Modal Angular UI - Modal to display information for a specific post. I have a DropDown with two options, "Delete" and "Edit".

DropDown

<div class="dropdown menu-feed">
 <span class="glyphicon glyphicon-option-vertical" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
 </span>
 <div class="dropdown-menu">                        
  <li><a class="dropdown-item" ng-click="vm.deleteComment()">Excluir</a></li>
 </div>
</div>

Controller Modal

            $uibModal.open({
            templateUrl: 'templates/feed/modal/modalPost.html',
            windowClass: 'post-modal',
            size: 'lg',
            controller: function ($uibModalInstance) {
            var vm = this;    
            vm.deleteComment = deleteComment;
            function deleteComment(){
               console.log('Aqui estou sendo chamado dentro do dropdown');
            }
            },controllerAs:'vm'
            });

However, no function is called, nor the functions that are within the modal (which I have omitted here to improve the visualization of the problem).

I tried the variable {{$ index}} within the modal and I have the return of which scope I am, however when I insert inside the "li" in the dropdown I have no bound scope.

Any tips on how to proceed?

    
asked by anonymous 05.01.2017 / 13:56

1 answer

2

Pass the current scope reference to uibModal:

$uibModal.open({
    templateUrl: 'templates/feed/modal/modalPost.html',
    scope: $scope, //referência
    [...]
    
05.01.2017 / 15:02