ng-if else的使用

<!DOCTYPE html>  
<html>  
  
<head>  
    <script src="http://code.angularjs.org/1.2.0-rc.2/angularjs.js"></script>  
    <script>  
        function mainController($scope)   
    {  
            $scope.data =   
            {  
                FName: 'Yogendra',  
                LName: 'Yadav'  
            };  
        }  
    </script>  
  
    <body ng-app>  
        <div ng-controller="mainController">  
            <h2>ng-if else in angularjs</h2>  
            <div>  
                <div ng-if="data.FName==='Yogendra'">  
                    Employee Name: {{FName}} {{LName}}  
                </div>  
                <div ng-if="data.FName===' '">  
                    Sample Code  
                </div>  
            </div>  
        </div>  
    </body>  
  
</html>

 

posted @ 2016-11-14 10:35  晓明的哥哥  阅读(20794)  评论(1编辑  收藏  举报