1

I have this html code with CSS. I want to put this in a directive template and re-use the directive, limiting scope to each element.

<div ng-controller="flipCtrl">
      <div class="flip"> <div class="card" ng-class="{'flipped':isFlipped}" ng-click="isFlipped=!isFlipped"> 
          <div class="face front">Project</div> 
            <div class="face back">TechLead</div> 
          </div>
      </div>
</div>      

I am not able to get it to work when I copy the entire text in the html into the template of directive.

the idea is that each flipcard will flip when clicked on it.

CSS

<style>
body {
 background: #ccc;   
}
.flip {
  -webkit-perspective: 800;
   width: 400px;
   height: 200px;
   position: relative;
   margin: 50px auto;
}
.flip .card.flipped {
  -webkit-transform: rotatex(-180deg);
}
.flip .card {
  width: 100%;
  height: 100%;
  -webkit-transform-style: preserve-3d;
  -webkit-transition: 0.5s;
}
.flip .card .face {
  width: 100%;
  height: 100%;
  position: absolute;
  -webkit-backface-visibility: hidden ;
  z-index: 2;
  font-family: Georgia;
  font-size: 3em;
  text-align: center;
  line-height: 200px;
}
.flip .card .front {
  position: absolute;
  z-index: 1;
  background: black;
  color: white;
  cursor: pointer;
}
.flip .card .back {
  -webkit-transform: rotatex(-180deg);
    background: blue;
    background: white;
    color: black;
    cursor: pointer;
}
</style>
user2180794
  • 1,425
  • 7
  • 27
  • 50
  • 1
    Please provide a plunker where you expose error, problem or trouble you're having when defining such directive... – miensol Sep 01 '14 at 06:37
  • possible duplicate of [How to implement a flip over effect using AnuglarJS animations?](http://stackoverflow.com/questions/23076094/how-to-implement-a-flip-over-effect-using-anuglarjs-animations) – ArtOfWarfare Oct 13 '14 at 01:53
  • the solution on this http://stackoverflow.com/questions/23076094/how-to-implement-a-flip-over-effect-using-anuglarjs-animations solved it for me. thanks – user2180794 Jan 20 '15 at 05:12

0 Answers0