/*
---AngularJS NgCLass Example---
For More Examples AngularJS
A Pen by mehmetcanker on CodePen.
/*
---AngularJS NgCLass Example---
For More Examples AngularJS
A Pen by mehmetcanker on CodePen.
| <html ng-app="mehmetCanker"> | |
| <head> | |
| <link href="//cdn.jsdelivr.net/foundation/5.0.2/css/foundation.css" rel="stylesheet" type="text/css"> | |
| <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.3/angular.min.js"></script> | |
| </script> | |
| </head> | |
| <body> | |
| <div ng-controller="ngClassExample" > | |
| <button ng-model="classBool" ng-init="classBool=false" ng-click="changeCss()">{{stat}}</button> | |
| <div ng-class="{panel:classBool}">Foundation Panel Block</div> | |
| </div> | |
| </body> | |
| </html> | 
| //More info htpp://mehmetcanker.com | |
| //Module Defining | |
| //Module Tanimlaniyor. | |
| var myApp = angular.module('mehmetCanker', []); | |
| //Creating Controller in mehmetCanker module | |
| //Olusturulan module icine controller //tanimladik | |
| myApp.controller('ngClassExample', ['$scope', function($scope){ | |
| //initial Value for Toggle Button Value | |
| $scope.stat = "Show"; | |
| //changeCss Function | |
| $scope.changeCss = function(){ | |
| $scope.classBool = !$scope.classBool; | |
| //Toggle Button Value is changed by classBool | |
| if($scope.classBool){ | |
| $scope.stat = "Hide"; | |
| }else{ | |
| $scope.stat = "Show"; | |
| } | |
| } | |
| }]); |