0

as mentioned in the title I want to make my ui-select double clickable i.e I can get the focus on it so I can copy the content of the ui-select .

here is an example: taken from https://codepen.io/anon/pen/NYQbWb I've added the disable property the existing code.

like in this example to double click batman for example and have the possibility to Ctrl + c it or right click copy ... I've tried to add the ng-readonly but it doesn't work.

Thanks for your help in advance.

HTML:

<div ng-app="boomstrap"><div ng-controller="SelectDemoCtrl">
 <div class="row">
   <div class="form-group">
    <div class="col-sm-6">
      <ui-select ng-model="superhero.selected" disabled="true">
      <ui-select-match placeholder="Select or search a superhero ..."> 
           {{$select.selected}}</ui-select-match>
      <ui-select-choices repeat="hero in getSuperheroes($select.search) | 
         filter: $select.search">
        <div ng-bind="hero"></div>
      </ui-select-choices>
    </ui-select>
  </div>
  <label class="col-sm-3 control-label">You have chosen {{ superhero.selected }}!</label>
</div>
</div>

JS:

(function(Boomstrap) {
'use strict';
Boomstrap.controller('SelectDemoCtrl', ['$scope', function($scope) {

$scope.superhero = {
  selected: 'Batman'
};

$scope.$watch('superhero.selected', function(newVal, oldVal) {
});

$scope.getSuperheroes = function(search) {
 var newSupes = $scope.superheroes.slice();
  if (search && newSupes.indexOf(search) === -1) {
    newSupes.unshift(search);
  }
  return newSupes;
}

$scope.superheroes = [
  'Superman',
  'Batman',
  'Spider-Man',
  'Thor',
  'Hal Jordan',
  'Wonder Woman',
  'Hulk',
  'Captain America',
  'Martian Manhunter',
  'Dick Grayson',
  'Thing',
  'Human Torch',
  'Fantastic',
  'Invisible Woman',
  'Wally West',
  'Aquaman',
  'Green Arrow',
  'Kyle Rayner',
  'Superboy',
  'Leonardo',
  'Raphael',
  'Donatello',
  'Michelangelo',
  'Silver Surfer',
  'Iron Man',
  'Barry Allen',
  'Tim Drake',
  'Black Canary',
  'Billy Batson',
  'Orion',
  'Hercules',
  'Daredevil',
  'Supergirl',
  'Black Panther',
  'Wolverine',
  'Cyborg',
  'Steel',
  'Donna Troy',
  'Vixen',
  'Raven',
  'Plastic Man',
  'Red Tornado',
  'Barbara Gordon',
  'Beast Boy',
  'Hawkgirl',
  'John Stewart',
  'Starfire',
  'Zatanna',
  'Ray Palmer',
  'Damian Wayne',
  'Huntress (Bertinelli)',
  'Hank Pym',
  'Hawkeye',
  'Professor X',
  'Jericho',
  'Rorschach',
  'Manhattan',
  'Nite Owl (Dreiberg)',
  'Nick Fury',
  'Hawkman',
  'Bart Allen',
  'Bucky Barnes',
  'Alan Scott',
  'Jay Garrick',
  'Cassandra Cain',
  'Phantom Stranger',
  'Blue Beetle',
  'Black Lightning',
  'Miracle',
  'Big Barda',
  'Booster Gold',
  'Kilowog',
  'Wasp',
  'Silk Spectre',
  'Miss Martian',
  'Knight',
  'Firestorm',
  'Nova',
  'Beast',
  'Skaar',
  'Lightray',
  'She-Hulk',
  'Captain Atom',
  'Power Girl',
  'Vision',
  'Damage',
  'Terrific',
  'Beta Ray Bill',
  'Squire',
  'Mon-El',
  'Black Widow',
  'Simon Baz',
  'Geo-Force',
  'Adam Strange',
  'Iron Fist',
  'Kaine',
  'Wildcat',
  'Jesse Chambers',
  'Wonder Man',
  'Carol Danve'
].sort();
}]);
})(angular.module('boomstrap'));
Gengetsu
  • 39
  • 1
  • 9

0 Answers0