0

In my controller, I am generating template dynamically with the REST API response and then showing the values as ion-radio.

My Code

var generatedTemplate = '<ion-list>';

angular.forEach($scope.longPressOptions, function(value, index) {
  generatedTemplate += '<ion-radio class="item-text-wrap" ng-model="longPressOptions.selectedValue" ng-value="' + value.wc_id + '">' + value.wc_name + '</ion-radio>';
}

generatedTemplate +=  '</ion-list>';

The value.wc_name may contain "<Default>", "N/A", ... values. These kind of values are not listed and shows error.

How to print the values as it is, without converting it to HTML format?

EDIT 1: (Image added)

<Default> should be displayed in the highlighted area.

enter image description here

EDIT 2: (Generated code)

<h5 style="border-bottom: 1px solid lightgray">Bystar 3015-2</h5> 
<ion-list>
  <ion-radio class="item-text-wrap" ng-model="longPressOptions.scheduleSelectedWC" ng-value="2"> //NewName 
  </ion-radio>
  <ion-radio class="item-text-wrap" ng-model="longPressOptions.scheduleSelectedWC" ng-value="10">N/A 
  </ion-radio>
  <ion-radio class="item-text-wrap" ng-model="longPressOptions.scheduleSelectedWC" ng-value="11"><Default> 
  </ion-radio>
</ion-list>
Naveen Kumar V
  • 2,559
  • 2
  • 29
  • 43

1 Answers1

0

You can print as string in html like

 <ion-radio class="item-text-wrap" ng-model="longPressOptions.scheduleSelectedWC" ng-value="11"> <![CDATA[ <default> ]]>
  </ion-radio>
Paresh Gami
  • 4,777
  • 5
  • 23
  • 41