compile angularjs template
angular.module("myModule", [])
.controller("myController", ['$scope', '$compile', function ($scope, $compile) {
$scope.txt = "<b>SampleTxt</b>";
$scope.submit = function () {
var html = $compile($scope.txt)($scope);
angular.element(document.getElementById("display")).append(html);
}
}]);
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<body ng-app="myModule" >
<div ng-controller="myController">
<textarea ng-model="txt" ></textarea>
<input type="button" value="submit" ng-click="submit()" />
<div id="display"></div>
</div>
</body>
Also in JavaScript:
- jsdoc optional param
- inject image javascript
- mongoose find multiple conditions
- express error middleware
- javascript convert px to vw
- jquery pause n seconds
- mixin in js
- javascript href redirect
- how to use inline javascript in html
- jest timeout
- local storage in js
- set readonly in javascript
- how to comments in json file
- node close rabbitmq connection
- react val
- should i use google pay
- sum all odd fibonacci numbers
- js get current seconds
- rest operator javascript
- javascript get elements that exist in two arrays
- java code that writes code in powerpoint
- rafraichir page javascript
- firebase get current user javascript
- js split string every n characters