Skip to content
This repository has been archived by the owner on Sep 8, 2020. It is now read-only.

Using directive within formatResult never compiles #278

Open
zyadsherif opened this issue Sep 16, 2014 · 0 comments
Open

Using directive within formatResult never compiles #278

zyadsherif opened this issue Sep 16, 2014 · 0 comments

Comments

@zyadsherif
Copy link

I have a problem were am using the formatResult option returning a string that has html with gravatar-src directive, it's not working and I couldn't attach the ng-bind-html to the option element because I don't have access to the value yet before page load, code is below.

<!-- template -->
<select ui-select2="statusSelectOptions" name="" id="" ng-model="defaultStatus" ng-change="statusChange()">
    <option ng-repeat="statue in issue.status" value="{{statue.id}}">{{statue.name}}</option>
 </select>
//Controller
    $scope.statusSelectOptions = {
      formatResult: $rootScope.format_icons,
      formatSelection: $rootScope.format_icons,
      minimumResultsForSearch: -1,
      escapeMarkup: function(m) {
        return m;
      }
    };

//formatting method
    $rootScope.format_image = function(object) {
      var originalOption = object.element;
        return "<img class='user-thumb' gravatar-src='" +  originalOption.email + "'/>" + object.text;
      // else
      //   return "<img class='user-thumb' src='" +  "https://i0.wp.com/s3.amazonaws.com/instabug-pro/na_missing_avatar_new.png?ssl=1" + "'/>" + object.text;
    }
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant