0

I make a auto suggest using filter .It show when user type on input field .But when user select any row of table I need to hide that table .In my my case I am not able to hide the table can you please tell me how to hide the table after select of row here is my fiddle

http://jsfiddle.net/66z4dxsy/2/ .In other word.When I run the program my table is hide .when I type on input field it show but when I select it again hide how I will achieve this.Please disable web security of browser .because it show cross domain error .

var app=angular.module("myapp",[]);
function cnt($scope,$http){
    $http.get("http://192.168.11.56/sstest")
        .success(function (data) {
           //alert(data);
            $scope.d=data;
        }).error(function(data){
                              alert("error")
        });

    $scope.getselectedRow=function(obj){
        alert(obj.stationName)   ;
        $scope.searchText.stationCode= obj.stationCode;
    }


}

Thanks

Thanks

4
  • Explain in detail what exactly do you want!! I am not sure but you may want like this - jsfiddle.net/66z4dxsy/3 Commented Oct 12, 2014 at 12:00
  • @JayShukla you understand wrong Commented Oct 12, 2014 at 12:11
  • @JayShukla you understand wrong.Actually My code is working fine .I just want to hide table after select ..In other word please do these steps.run the code write "h" in input field .it show table .and select any row from table.then I need to hide the table.When u select the row it it set the value of selected item on input field but not hide Commented Oct 12, 2014 at 12:14
  • @JayShukla did you get understand ? Commented Oct 12, 2014 at 12:20

2 Answers 2

1

I don't know what you want to achieve by doing this but what you want that can be done by adding one more condition as below.

<input type="text" ng-model="searchText.stationCode" ng-focus="selected=true">

See updated fiddle here Fiddle Link

Sign up to request clarification or add additional context in comments.

Comments

0

Because the visibility of your table is bound to:

<table ng-show="searchText.stationCode && searchText.stationCode.length != 0">

All you have to do is to set searchText.stationCode = null in your code. If you are in some asynchronous context (callback from an ajax) you might need to force update

$scope.searchText.stationCode = null;
$scope.$apply()

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.