angular.module("Angular", []) .controller("AngularCtrl", function ($scope) { $scope.setPhone = function(phone, user_phone) { return phone ? "<input type='text' id='phone' value='" + user_phone + "'>" : user_phone; }; }) .filter('html', function($sce) { return function(val) { return $sce.trustAsHtml(val); }; }); Above, in fact, the code; below - html:
<div class="col-sm-3"> {{setPhone(phone, '<?= $user['phone'] ?>') | html}} </div> <div class="col-sm-1"> <div class="checkbox"> <input type="checkbox" ng-model="phone"> </div> </div> I can not understand why the filter does not work (as the method also does not work, if you make an alternative, with the same function).