Monday, 24 April 2017

AngularJS-18 : ng-hide and ng-show


AngularJS-18 : ng-hide and ng-show












angular.min.js
-------------------------------------


Script.js
------------------------------------

/// <reference path="angular.min.js" />

var myAppModule = angular.module("myAppModule",[]).
    controller("myDataController",function ($scope) {
        var employees =
            [
                {
                    firstName : "pavan",
                    gender : "Male",
                    city : "Bangalore",
                    salary : 55000
                },
                {
                    firstName : "payoswini",
                    gender : "Female",
                    city : "Mysore",
                    salary : 61000
                },
                {
                    firstName : "madhu",
                    gender : "Male",
                    city : "Tumkur",
                    salary : 45000
                },
                {
                    firstName : "XYZ",
                    gender : "Male",
                    city : "Mumbai",
                    salary : 93000
                }
            ]
    $scope.employees = employees;

});




myHTML.html
---------------------------------------

<!DOCTYPE html>
<html ng-app="myAppModule">
    <head>
        <script type="text/javascript" src="resources/js/angular.min.js"></script>
        <script type="text/javascript" src="resources/js/Script.js"></script>
        <link type="text/css" rel="stylesheet" href="resources/myCSS.css"/>
    </head>
    <body ng-controller="myDataController">
    <input type="checkbox" ng-model="hideSalary"/>Hide Salary
        <table>
            <thead>
                <tr>
                    <th>First Name </th>
                     <th>Gender</th>
                     <th>City</th>
                     <th ng-show="!hideSalary">Salary</th>
                </tr>
            </thead>
            <tbody>
                <tr ng-repeat="emp in employees">
                    <td>{{emp.firstName}}</td>
                    <td>{{emp.gender}}</td>
                    <td>{{emp.city}}</td>
                    <td ng-show="!hideSalary">{{emp.salary}}</td>
                </tr>
            </tbody>
        </table>
       
   
    </body>
</html>











No comments:

Post a Comment

AngularJS-24 : Router

AngularJS-24 : Router https://www.youtube.com/watch?v=hThmoKA9aeU#t=427.383649 Download "angular-route.min.js"and add to p...