2017-11-07 7 views
0

私はangularjs.whatを初めて使用しました。これはangularjsで検索しているテキストを強調表示するための指示です。 例: 検索ボックスにテキスト「ABC」を入力していて、それが存在する場合は応答として強調表示する必要があります。 ありがとうございます。anglejsを使用して選択したテキストを強調表示するための指示

+0

探しているものであるあなたはqueryStringパラメータのオフ検索を意味しますか? –

答えて

0

午前は、右ここであなたを取得する場合は、

var myApp = angular.module('myApp',[]); 
 

 
myApp.controller('MyCtrl',function($scope, $timeout) { 
 

 
}); 
 

 
myApp.directive('searchColor', function() { 
 
    return { 
 
     restrict: 'AC', 
 
     link: function (scope, element, attrs) {   
 
      element.css('color', 'red');         
 
     } 
 
    } 
 
});
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.6/angular.min.js"></script> 
 
<div ng-app="myApp" ng-controller="MyCtrl"> 
 
    <input type="text" ng-model="t" search-color placeholder="type something here"/> 
 
</div>

関連する問題