我正在尝试绑定一个scope变量,<span>并且如果范围变量为空,我正在尝试显示一些默认文本。我尝试使用ng-bindand{{}}但找不到解决方案。这是问题的说明
这是我的控制器
myApp.controller("MyCtrl",function($scope) {
$scope.level = "iResult";
$scope.reset =function(){
$scope.level = "";
};
Run Code Online (Sandbox Code Playgroud)
这是模板
<div ng-controller="MyCtrl" id="tableForVxp" class="dataDisplay2">
{{level}}
<button ng-click="reset()">RESET</button>
<p>On click of reset the level get updated as blank and if its blank i want a default text "NoneLeft" to be displayed</p>
Run Code Online (Sandbox Code Playgroud)
我不是在寻找使用的解决方案ng-if,ng-show,ng-hide。
| 归档时间: |
|
| 查看次数: |
1133 次 |
| 最近记录: |