I have developed a new directive and I am looking to incorporate a dynamic template using the attribute wm.data.typeName
.
wm.data.typeName = "<span>html code</span>"
<fill-choose model-input="wm.data.modelInput" text="wm.data.typeName"></fill-choose>
The key component here is the directive fillChoose.
(function() {
'use strict';
angular
.module('learn')
.directive('fillChoose', fillChoose);
/** @ngInject */
function fillChoose($showdown) {
var directive = {
restrict: 'AE',
template: function(elem, attr) {
//return $showdown.makeHtml(fill.modelInput);
return '<div>'+ attr.modelInput +'</div>';
},
scope: {
modelInput: '=',
text: '='
},
controller: FillChooseController,
controllerAs: 'fill',
bindToController: true
};
return directive;
/** @ngInject */
function FillChooseController($scope) {
var vm = this;
}
}
})();
However, I am facing an issue where the template output is
<div>wm.data.modelInput</div>
.
Is there a way to ensure that the template renders as
<div><span>html code</span></div>
instead?