I have created an angularjs directive called image-multiselect which can be used as follows.
<image-multiselect items="landTransportTypes" image="illustrationURL" itemname="name" append="<div class='detail'>...some html here...</div>"></image-multiselect>
Notice the append attribute which is assigned an html as string. This html string i expect to use for modifying the template
attribute in the DDO as follows
function(){
var imageMultiselect = function(){
return {
scope : {
items: "=",
image: "@",
itemname: "@",
append: "@"
},
template : "<div style='background:#f2f2f2;padding:20px;margin:20px;border-radius:5px;min-height:100px;'>" +
"<div ng-repeat='item in items' class='card text-center'>" +
"<img class='card-img' src='{{item[image]}}' alt='Avatar'>" +
"<div class='detail'>" +
"<b>{{item[itemname]}}</b>" +
/*append used to customize template as per requirement*/
"{{append}}"+
"</div>" +
"</div>" +
"</div>"
}
}
angular.module("myApp").directive("imageMultiselect",imageMultiselect);
}());
Problem : The html string passed in the append is not rendered as html rather entire markup is displayed as it is on the page ?