Search code examples
angularjsintegrationmathml

AngularJS Wiris integration


I'm a beginner at AngularJS. As a first project, I'm trying to set up a simple Angular project which integrates Wiris.

enter image description here

Actually seeing and interacting with the plugin is the extent of my progress. My problems begin when I try to get the data in the textarea.

I try using the following approach:

<div ng-model="questionData" id="editorContainer"
     style='width:100%; height:500px;'>
  Responsible!
</div>
<input type="button" value="Submit" ng-click="postQuestion()" />
headlessQS.controller('wirisController', ['$scope', '$route', '$routeParams', function($scope, $route, $routeParams){

    $scope.postQuestion = function(){
//        console.log($scope.questionData.wrs_previewImage);
//        console.log( angular.element('#editorContainer').val() );
//        console.log( $('#editorContainer').val() );
//        console.log(angular.element('[id="username"]').val());
//        console.log(angular.element('#editorContainer').html);

        console.log( angular.element('#editorContainer').val() );
        console.log( angular.element('#editorContainer')[0].value );
    }
}]);

I tried each one of those console.log statements unsuccessfully but something tells me my general approach is wrong.

I am looking to integrate Wiris with AngularJS2 so that I can retrieve the formula created. How can I do that?


Solution

  • The way to access the MathML markup is via the getMathML() Wiris api function call as shown below:

    $scope.postQuestion = function(){
        console.log( editor.getMathML() );
    }