Getelementbyid in popup


#1

I’d like to call popup and some js function with one button. I need to change texts in popup with this function. My popup code is:

angular.module('starter')
  .controller('PopupCtrl', function($scope, $ionicPopup, $timeout) {
    $scope.showAlert = function() {
      var alertPopup = $ionicPopup.alert({
        title: '<div id="location-status"></div>',
        template: '<div class="text-center"><ion-spinner icon="ripple" class="spinner-positive"></ion-spinner></div>'
      });
    };
  });

Function is simple so far:

function writeText() {
  document.getElementById("location-status").innerHTML = "Some text"
}

And button:

<button class="button button-icon icon ion-android-locate" ng-click="showAlert()" onclick="writeText()"></button>

It works when my

is somewhere in index.html file. It didn’t work in popup. What’s wrong.