2017-01-31 21 views
1

私は角に新しいですし、私はこだわっていて、検索フィールドに検索したい...
私はthis image場所のプレースホルダに示すようにドロップダウンを作成したいですテキストボックスは、ドロップダウンから選択したオプションによって異なります。:ドロップダウンからオプションを選択する上で、私はその値

私のHTMLは私のコントローラのように定義されて

<select class="selectpicker" ng-options="search for search in searchCriteria" ng-model="searchWith"> 
    <option value="">Select : </option> 
</select> 

<input type="text" ng-model="searchName" class="form-control" placeholder="Search with {{searchWith}}" /> 

です:

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

companyInfo.controller('searchExample', ['$scope', '$http',function($scope, $http){ 
    $scope.searchCriteria = ['Name', 'Employee Id', 'Designation', 'Email','Phone No'] 

    $http.get("data/data.json").then(function(data){ 
     $scope.employeeDetails= data.data;  
    }); 

    $scope.searchInTable = function(searchName){ 
     $scope.searchVal = searchName; 
    }  
}]); 

答えて

0

あなたはこのdata-ng-changeを試すことができ、指定された関数

<select class="selectpicker" ng-options="search for search in searchCriteria" ng-model="searchWith" data-ng-change="search()"> 
    <option value="">Select : </option> 
</select> 

<input type="text" ng-model="searchName" class="form-control" placeholder="Search with {{searchWith}}" /> 

と選択の変化にイベントをバインドしますお使いのコントローラで

$scope.search = function(){ 
    $scope.searchName = $scope.searchWith; 
} 
関連する問題