angularJs中的ng-show指令

来源:互联网 发布:淘宝店铺客服不回话 编辑:程序博客网 时间:2024/06/05 03:45

单选框选定控制ng-show的显示和隐藏

ng-show="status==0" //ng-show里可以写表达式,该表达式意思是:status值为0的时候,该区域显示。
<!doctype html><html lang="en"><head>    <meta charset="UTF-8">    <script src="angular.min.js"></script></head><body><div ng-app="module" ng-controller="ctrl">    网站开启:    <input type="radio" ng-model="status" ng-value="1"> 开启    <input type="radio" ng-model="status" ng-value="0"> 关闭    {{status}}    <div ng-show="status==0">        <h2>关闭原因:</h2>        <textarea>该网正在维护中,2:00可以访问</textarea>    </div></div><script>    var m = angular.module('module', []);    m.controller('ctrl', ['$scope', function ($scope) {        $scope.status=1;    }]);</script></body></html>

效果图:
这里写图片描述

这里写图片描述

原创粉丝点击