I am working on a game made with corner. I have one problem that I have not been able to solve yet. I would like to use a pop-up dialog box (without warning), the contents of which depend on the context. This popup contains a button that, when clicked, starts with the game.
Since the content is dynamic, the ng-click function does not work.
I tried with directives and directly from the controller, but did not get it to work.
My specific question is how to add an HTML button to an element with corner elements containing an ng-click function that really works?
Edit: here is one try (actually a button appears for showing, but ng-click does nothing): Controller:
{ if ($scope.quiz.state === 'finished' || $scope.quiz.state === 'initialized') { var startButton = '<br><br><button data-ng-click="startQuiz">start quiz</button>'; $scope.popupText = $sce.trustAsHtml('Stating ' + quiz.name + startButton); $scope.showStart = false; $scope.showPopup = true; } }; $scope.startQuiz = function() { $scope.showPopup = false; if ($scope.quiz.state === 'initialized') { $scope.quiz.start(); $scope.quizTimer.start($scope, $timeout); } };
Html:
<div id="popupBox"> <div id="closePopup" data-ng-click="closePopup()">X</div> <div data-ng-bind-html="popupText"></div> </div>
source share