Skip to content

Instantly share code, notes, and snippets.

Created December 14, 2013 14:40
Show Gist options
  • Save anonymous/7959969 to your computer and use it in GitHub Desktop.
Save anonymous/7959969 to your computer and use it in GitHub Desktop.

Revisions

  1. @invalid-email-address Anonymous created this gist Dec 14, 2013.
    14 changes: 14 additions & 0 deletions AngularJS-NgClass-Example.markdown
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    AngularJS NgClass Example
    -------------------------
    /*

    ---AngularJS NgCLass Example---

    For More Examples AngularJS

    http://mehmetcanker.com


    A [Pen](http://codepen.io/mehmetcanker/pen/soHik) by [mehmetcanker](http://codepen.io/mehmetcanker) on [CodePen](http://codepen.io/).

    [License](http://codepen.io/mehmetcanker/pen/soHik/license).
    20 changes: 20 additions & 0 deletions index.html
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    <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>
    31 changes: 31 additions & 0 deletions script.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,31 @@
    //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";
    }


    }



    }]);