问题:如果距离为空/我,我试图隐藏一个值。
我尝试了以下操作,但值仍然显示:
<div ng-hide="e.distance == null"><strong>Distance: </strong>{{e.distance}}</div><br />
和
<div ng-show="e.distance != null"><strong>Distance: </strong>{{e.distance}}</div><br />
实现目标的正确方法是什么。
以下是我如何定义coldfusion中的距离:
<cfif isdefined("Distance")>
<cfset qDistance="#Distance#">
<cfelse>
<cfset qDistance="5">
</cfif>
DECLARE @lat float
, @lon float
, @dist int = <cfqueryparam value = "#qDistance#" cfsqltype = "cf_sql_integer">
当我提出以下建议时:
ng-show =&#34; e.distance === undefined&#34;
当我做其他建议时,例如ng-hide =&#34; e.distance&#34;,
以下是提供商包含的内容:
indexApp.controller('IndexController',function($scope,$http,$location,anchorSmoothScroll){
$scope.Lang = 'initVal';
$scope.ShowResults = false;
$scope.ShowDesc = true;
$scope.NoResults = false;
$scope.currentPage = 1;
$scope.maxPageNumbersToShow = 10;
$scope.formModel = {};
$scope.searchMode = 0;
$scope.miles = [{'value':'5'},{'value':'10'},{'value':'15'},{'value':'20' }];
$scope.Specialties = [{'value':'Family practice'},{'value':'General practice'},{'value':'Internal medicine'},{'value':'Pediatrics'}];
$scope.Gender = [{'value':'Male'},{'value':'Female'}];
$scope.Languages = {};
$scope.Cities = {};
$scope.searchParam = {};
$("input").removeAttr('disabled');
$scope.searchParam.Distance = $scope.miles[0];
答案 0 :(得分:0)
尝试这样使用:
<div ng-show="e.distance"><strong>Distance: </strong>{{e.distance}}</div><br />
答案 1 :(得分:0)
您可以尝试使用ng-if代替ng-show并检查变量,如下所示:
<div ng-if="e.distance"><strong>Distance: </strong>{{e.distance}}</div><br />