Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/405.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 在angular js中选择行后如何隐藏表?_Javascript_Jquery_Angularjs_Angularjs Directive_Angularjs Scope - Fatal编程技术网

Javascript 在angular js中选择行后如何隐藏表?

Javascript 在angular js中选择行后如何隐藏表?,javascript,jquery,angularjs,angularjs-directive,angularjs-scope,Javascript,Jquery,Angularjs,Angularjs Directive,Angularjs Scope,我使用过滤器进行自动建议。它显示用户在输入字段上键入的时间。但是当用户选择表格的任何一行时,我需要隐藏该表格。在我的情况下,我无法隐藏表格。请告诉我在选择行后如何隐藏表格。这是我的小提琴 。换句话说。当我运行程序时,我的表是隐藏的。当我在输入字段中键入时,它会显示,但当我再次选择它时,它会隐藏我将如何实现这一点。请禁用浏览器的web安全性。因为它会显示跨域错误 var app=angular.module("myapp",[]); function cnt($scope,$http){

我使用过滤器进行自动建议。它显示用户在输入字段上键入的时间。但是当用户选择表格的任何一行时,我需要隐藏该表格。在我的情况下,我无法隐藏表格。请告诉我在选择行后如何隐藏表格。这是我的小提琴

。换句话说。当我运行程序时,我的表是隐藏的。当我在输入字段中键入时,它会显示,但当我再次选择它时,它会隐藏我将如何实现这一点。请禁用浏览器的web安全性。因为它会显示跨域错误

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;
    }


}
谢谢


谢谢

我不知道你想通过这样做实现什么,但是你想通过添加一个条件来实现,如下所示

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


请参见此处更新的fiddle,因为表的可见性绑定到:

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

详细解释你到底想要什么!!我不确定,但你可能想要这样-@JayShukla,你明白吗wrong@JayShukla你理解错了。实际上我的代码运行得很好。我只想在选择后隐藏表。换句话说,请执行这些步骤。运行代码写“h”在输入字段中。它显示表格。并从表格中选择任何行。然后我需要隐藏表格。当您选择该行时,它会在输入字段中设置所选项目的值,但不会hide@JayShukla你明白了吗?
$scope.searchText.stationCode = null;
$scope.$apply()