My requirement is user runtime input should be converted to Matjax format I tried as follows
script
var app=angular.module('app',[]);
app.run(function($rootScope){
$rootScope.$watch(function(){
MathJax.Hub.Queue(["Typeset",MathJax.Hub]);
return true;
});
});
app.controller('math',function($scope){
$scope.update = function() {
$scope.Expression = $scope.mathtext;
MathJax.Hub.Queue(["Typeset",MathJax.Hub]);
}
$scope.Expression = 'Evaluate: `( 5/4 div 1/6 )`';
});
Html
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css">
<script data-require="angular.js@1.4.8" data-semver="1.4.8" src="https://code.angularjs.org/1.4.8/angular.js"></script>
<script async src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=AM_HTMLorMML-full.js"> </script>
<script src="script.js"></script>
</head>
<body ng-app="app">
<div ng-controller="math">
<input type="text" ng-model="mathtext" ng-change="update()"/>
<div id="mathjaxtext"></div>
</div>
</body>
</html>
Expected result when user type
5/8
it should show 5/8 mathjax format
But what I get is
5/8(54÷16) (the previous value also preserve in this how to get only the user typed content get converted?
Source: AngularJS
from Angular Questions https://angularquestions.com/2017/09/25/mathjax-and-angualrjs-dynamic-model-updating-issue/
via @lzomedia #developer #freelance #web
No comments:
Post a Comment